@flashphoner/websdk 2.0.208 → 2.0.212
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docTemplate/README.md +1 -1
- package/examples/demo/streaming/2players/2players.js +0 -5
- package/examples/demo/streaming/canvas_streaming/canvas_streaming.js +0 -12
- package/examples/demo/streaming/conference/conference.html +6 -0
- package/examples/demo/streaming/conference/conference.js +83 -23
- package/examples/demo/streaming/embed_player/player.js +127 -198
- package/examples/demo/streaming/firewall-traversal-streaming/firewall-traversal-streaming.js +0 -12
- package/examples/demo/streaming/mcu_client/mcu_client.js +0 -8
- package/examples/demo/streaming/media_devices_manager/manager.js +0 -12
- package/examples/demo/streaming/player/player.js +10 -9
- package/examples/demo/streaming/stream-auto-restore/stream-auto-restore.html +77 -1
- package/examples/demo/streaming/stream-auto-restore/stream-auto-restore.js +472 -84
- package/examples/demo/streaming/stream-diagnostic/stream-diagnostic.js +0 -8
- package/examples/demo/streaming/stream-local-snapshot/stream-local-snapshot.js +0 -6
- package/examples/demo/streaming/stream-snapshot/stream-snapshot.js +0 -6
- package/examples/demo/streaming/stream_recording/recording.js +0 -6
- package/examples/demo/streaming/streamer/streamer.js +0 -8
- package/examples/demo/streaming/two_way_streaming/two_way_streaming.js +0 -11
- package/examples/demo/streaming/webrtc-as-rtmp-republishing/webrtc-as-rtmp-republishing.js +0 -6
- package/flashphoner-no-flash.js +118 -14
- package/flashphoner-no-flash.min.js +2 -2
- package/flashphoner-no-webrtc.js +89 -5
- package/flashphoner-no-webrtc.min.js +1 -1
- package/flashphoner-no-wsplayer.js +118 -14
- package/flashphoner-no-wsplayer.min.js +2 -2
- package/flashphoner-room-api.js +104 -9
- package/flashphoner-room-api.min.js +2 -2
- package/flashphoner-temasys-flash-websocket-without-adapterjs.js +89 -5
- package/flashphoner-temasys-flash-websocket.js +89 -5
- package/flashphoner-temasys-flash-websocket.min.js +1 -1
- package/flashphoner-webrtc-only.js +118 -14
- package/flashphoner-webrtc-only.min.js +1 -1
- package/flashphoner.js +118 -14
- package/flashphoner.min.js +2 -2
- package/package.json +1 -1
- package/src/flashphoner-core.d.ts +22 -5
- package/src/flashphoner-core.js +79 -3
- package/src/webrtc-media-provider.js +25 -6
|
@@ -8898,6 +8898,9 @@ var getSession = function getSession(id) {
|
|
|
8898
8898
|
* @param {Object=} options.sipOptions Sip configuration
|
|
8899
8899
|
* @param {Object=} options.mediaOptions Media connection configuration
|
|
8900
8900
|
* @param {Integer=} options.timeout Connection timeout in milliseconds
|
|
8901
|
+
* @param {Integer=} options.pingInterval Server ping interval in milliseconds [0]
|
|
8902
|
+
* @param {Integer=} options.receiveProbes A maximum subsequental pings received missing count [0]
|
|
8903
|
+
* @param {Integer=} options.probesInterval Interval to check subsequental pings received [0]
|
|
8901
8904
|
* @returns {Session} Created session
|
|
8902
8905
|
* @throws {Error} Error if API is not initialized
|
|
8903
8906
|
* @throws {TypeError} Error if options.urlServer is not specified
|
|
@@ -8924,6 +8927,8 @@ var createSession = function createSession(options) {
|
|
|
8924
8927
|
var mediaOptions = options.mediaOptions;
|
|
8925
8928
|
var keepAlive = options.keepAlive;
|
|
8926
8929
|
var timeout = options.timeout;
|
|
8930
|
+
var wsPingSender = new WSPingSender(options.pingInterval || 0);
|
|
8931
|
+
var wsPingReceiver = new WSPingReceiver(options.receiveProbes || 0, options.probesInterval || 0);
|
|
8927
8932
|
var connectionTimeout;
|
|
8928
8933
|
var cConfig; //SIP config
|
|
8929
8934
|
|
|
@@ -9041,7 +9046,7 @@ var createSession = function createSession(options) {
|
|
|
9041
9046
|
mediaProviders: Object.keys(MediaProvider),
|
|
9042
9047
|
keepAlive: keepAlive,
|
|
9043
9048
|
authToken: authToken,
|
|
9044
|
-
clientVersion: "2.0.
|
|
9049
|
+
clientVersion: "2.0.212",
|
|
9045
9050
|
clientOSVersion: window.navigator.appVersion,
|
|
9046
9051
|
clientBrowserVersion: window.navigator.userAgent,
|
|
9047
9052
|
msePacketizationVersion: 2,
|
|
@@ -9054,7 +9059,11 @@ var createSession = function createSession(options) {
|
|
|
9054
9059
|
|
|
9055
9060
|
|
|
9056
9061
|
send("connection", cConfig);
|
|
9057
|
-
logger.setConnection(wsConnection);
|
|
9062
|
+
logger.setConnection(wsConnection); // Send ping messages to server to check if connection is still alive #WCS-3410
|
|
9063
|
+
|
|
9064
|
+
wsPingSender.start(); // Check subsequintel pings received from server to check if connection is still alive #WCS-3410
|
|
9065
|
+
|
|
9066
|
+
wsPingReceiver.start();
|
|
9058
9067
|
};
|
|
9059
9068
|
|
|
9060
9069
|
wsConnection.onmessage = function (event) {
|
|
@@ -9070,6 +9079,7 @@ var createSession = function createSession(options) {
|
|
|
9070
9079
|
switch (data.message) {
|
|
9071
9080
|
case 'ping':
|
|
9072
9081
|
send("pong", null);
|
|
9082
|
+
wsPingReceiver.success();
|
|
9073
9083
|
break;
|
|
9074
9084
|
|
|
9075
9085
|
case 'getUserData':
|
|
@@ -9229,7 +9239,11 @@ var createSession = function createSession(options) {
|
|
|
9229
9239
|
sessionStatus = newStatus;
|
|
9230
9240
|
|
|
9231
9241
|
if (sessionStatus == SESSION_STATUS.DISCONNECTED || sessionStatus == SESSION_STATUS.FAILED) {
|
|
9232
|
-
//
|
|
9242
|
+
// Stop pinging server #WCS-3410
|
|
9243
|
+
wsPingSender.stop(); // Stop checking pings received #WCS-3410
|
|
9244
|
+
|
|
9245
|
+
wsPingReceiver.stop(); //remove streams
|
|
9246
|
+
|
|
9233
9247
|
for (var prop in streamRefreshHandlers) {
|
|
9234
9248
|
if (streamRefreshHandlers.hasOwnProperty(prop) && typeof streamRefreshHandlers[prop] === 'function') {
|
|
9235
9249
|
streamRefreshHandlers[prop]({
|
|
@@ -9245,6 +9259,73 @@ var createSession = function createSession(options) {
|
|
|
9245
9259
|
if (callbacks[sessionStatus]) {
|
|
9246
9260
|
callbacks[sessionStatus](session, obj);
|
|
9247
9261
|
}
|
|
9262
|
+
} // Websocket periodic ping sender
|
|
9263
|
+
|
|
9264
|
+
|
|
9265
|
+
function WSPingSender(interval) {
|
|
9266
|
+
this.interval = interval || 0;
|
|
9267
|
+
this.intervalId = null;
|
|
9268
|
+
|
|
9269
|
+
this.start = function () {
|
|
9270
|
+
if (this.interval > 0) {
|
|
9271
|
+
this.intervalId = setInterval(function () {
|
|
9272
|
+
send("ping", null);
|
|
9273
|
+
}, this.interval);
|
|
9274
|
+
}
|
|
9275
|
+
};
|
|
9276
|
+
|
|
9277
|
+
this.stop = function () {
|
|
9278
|
+
if (this.intervalId) {
|
|
9279
|
+
clearInterval(this.intervalId);
|
|
9280
|
+
}
|
|
9281
|
+
};
|
|
9282
|
+
|
|
9283
|
+
return this;
|
|
9284
|
+
} // Websocket ping receive prober
|
|
9285
|
+
|
|
9286
|
+
|
|
9287
|
+
function WSPingReceiver(receiveProbes, probesInterval) {
|
|
9288
|
+
this.maxPings = receiveProbes || 0;
|
|
9289
|
+
this.interval = probesInterval || 0;
|
|
9290
|
+
this.intervalId = null;
|
|
9291
|
+
this.pingsMissing = 0;
|
|
9292
|
+
|
|
9293
|
+
this.start = function () {
|
|
9294
|
+
if (this.maxPings > 0 && this.interval > 0) {
|
|
9295
|
+
var receiver = this;
|
|
9296
|
+
this.intervalId = setInterval(function () {
|
|
9297
|
+
receiver.checkPingsReceived();
|
|
9298
|
+
}, this.interval);
|
|
9299
|
+
}
|
|
9300
|
+
};
|
|
9301
|
+
|
|
9302
|
+
this.stop = function () {
|
|
9303
|
+
if (this.intervalId) {
|
|
9304
|
+
clearInterval(this.intervalId);
|
|
9305
|
+
}
|
|
9306
|
+
|
|
9307
|
+
this.pingsMissing = 0;
|
|
9308
|
+
};
|
|
9309
|
+
|
|
9310
|
+
this.checkPingsReceived = function () {
|
|
9311
|
+
this.pingsMissing++;
|
|
9312
|
+
|
|
9313
|
+
if (this.pingsMissing >= this.maxPings) {
|
|
9314
|
+
this.failure();
|
|
9315
|
+
}
|
|
9316
|
+
};
|
|
9317
|
+
|
|
9318
|
+
this.success = function () {
|
|
9319
|
+
this.pingsMissing = 0;
|
|
9320
|
+
};
|
|
9321
|
+
|
|
9322
|
+
this.failure = function () {
|
|
9323
|
+
logger.info(LOG_PREFIX, "Missing " + this.pingsMissing + " pings from server, connection seems to be down");
|
|
9324
|
+
onSessionStatusChange(SESSION_STATUS.FAILED);
|
|
9325
|
+
wsConnection.close();
|
|
9326
|
+
};
|
|
9327
|
+
|
|
9328
|
+
return this;
|
|
9248
9329
|
}
|
|
9249
9330
|
/**
|
|
9250
9331
|
* @callback sdpHook
|
|
@@ -10109,7 +10190,7 @@ var createSession = function createSession(options) {
|
|
|
10109
10190
|
* @param {HTMLElement} options.display Div element stream should be displayed in
|
|
10110
10191
|
* @param {Object=} options.custom User provided custom object that will be available in REST App code
|
|
10111
10192
|
* @param {Integer} [options.flashBufferTime=0] Specifies how long to buffer messages before starting to display the stream (Flash-only)
|
|
10112
|
-
* @param {
|
|
10193
|
+
* @param {string=} options.stripCodecs Comma separated string of codecs which should be stripped from WebRTC SDP (ex. "H264,PCMA,PCMU,G722")
|
|
10113
10194
|
* @param {string=} options.rtmpUrl Rtmp url stream should be forwarded to
|
|
10114
10195
|
* @param {Object=} options.mediaConnectionConstraints Stream specific constraints for underlying RTCPeerConnection
|
|
10115
10196
|
* @param {Boolean=} options.flashShowFullScreenButton Show full screen button in flash
|
|
@@ -10118,6 +10199,7 @@ var createSession = function createSession(options) {
|
|
|
10118
10199
|
* @param {Integer=} options.playoutDelay Time delay between network reception of media and playout
|
|
10119
10200
|
* @param {string=} options.useCanvasMediaStream EXPERIMENTAL: when publish bind browser's media stream to the canvas. It can be useful for image filtering
|
|
10120
10201
|
* @param {string=} options.videoContentHint Video content hint for browser ('detail' by default to maintain resolution), {@link Flashphoner.constants.CONTENT_HINT_TYPE}
|
|
10202
|
+
* @param {Boolean=} options.unmutePlayOnStart Unmute playback on start. May be used after user gesture only, so set 'unmutePlayOnStart: false' for autoplay
|
|
10121
10203
|
* @param {sdpHook} sdpHook The callback that handles sdp from the server
|
|
10122
10204
|
* @returns {Stream} Stream
|
|
10123
10205
|
* @throws {TypeError} Error if no options provided
|
|
@@ -10229,6 +10311,7 @@ var createSession = function createSession(options) {
|
|
|
10229
10311
|
var playoutDelay = options.playoutDelay;
|
|
10230
10312
|
var useCanvasMediaStream = options.useCanvasMediaStream;
|
|
10231
10313
|
var videoContentHint = options.videoContentHint;
|
|
10314
|
+
var unmutePlayOnStart = options.unmutePlayOnStart;
|
|
10232
10315
|
var audioState_;
|
|
10233
10316
|
var videoState_;
|
|
10234
10317
|
var connectionQuality;
|
|
@@ -10405,7 +10488,8 @@ var createSession = function createSession(options) {
|
|
|
10405
10488
|
connectionConstraints: mediaConnectionConstraints,
|
|
10406
10489
|
audioOutputId: audioOutputId,
|
|
10407
10490
|
remoteVideo: remoteVideo,
|
|
10408
|
-
playoutDelay: playoutDelay
|
|
10491
|
+
playoutDelay: playoutDelay,
|
|
10492
|
+
unmutePlayOnStart: unmutePlayOnStart
|
|
10409
10493
|
}, streamRefreshHandlers[id_]).then(function (newConnection) {
|
|
10410
10494
|
mediaConnection = newConnection;
|
|
10411
10495
|
|
|
@@ -11923,7 +12007,9 @@ var createConnection = function createConnection(options) {
|
|
|
11923
12007
|
var screenShare = false;
|
|
11924
12008
|
var playoutDelay = options.playoutDelay; // Set video track contentHint to `detail` by default to workaround Chromium 91 bug #WCS-3257
|
|
11925
12009
|
|
|
11926
|
-
var videoContentHint = options.videoContentHint ? options.videoContentHint : 'detail';
|
|
12010
|
+
var videoContentHint = options.videoContentHint ? options.videoContentHint : 'detail'; // Pass the option to unmute automatically (true by default) #WCS-2425
|
|
12011
|
+
|
|
12012
|
+
var unmutePlayOnStart = options.unmutePlayOnStart !== undefined ? options.unmutePlayOnStart : true;
|
|
11927
12013
|
|
|
11928
12014
|
if (bidirectional) {
|
|
11929
12015
|
localVideo = getCacheInstance(localDisplay);
|
|
@@ -11942,7 +12028,7 @@ var createConnection = function createConnection(options) {
|
|
|
11942
12028
|
remoteVideo = getCacheInstance(remoteDisplay);
|
|
11943
12029
|
|
|
11944
12030
|
if (!remoteVideo) {
|
|
11945
|
-
remoteVideo =
|
|
12031
|
+
remoteVideo = createVideoElement();
|
|
11946
12032
|
remoteDisplay.appendChild(remoteVideo);
|
|
11947
12033
|
}
|
|
11948
12034
|
|
|
@@ -11967,7 +12053,7 @@ var createConnection = function createConnection(options) {
|
|
|
11967
12053
|
if (cachedVideo) {
|
|
11968
12054
|
remoteVideo = cachedVideo;
|
|
11969
12055
|
} else {
|
|
11970
|
-
remoteVideo =
|
|
12056
|
+
remoteVideo = createVideoElement();
|
|
11971
12057
|
display.appendChild(remoteVideo);
|
|
11972
12058
|
}
|
|
11973
12059
|
|
|
@@ -12031,7 +12117,12 @@ var createConnection = function createConnection(options) {
|
|
|
12031
12117
|
|
|
12032
12118
|
remoteVideo.onloadedmetadata = function (e) {
|
|
12033
12119
|
if (remoteVideo) {
|
|
12034
|
-
remoteVideo.play()
|
|
12120
|
+
remoteVideo.play().then(function () {
|
|
12121
|
+
// Automatically unmute video if needed #WCS-2425
|
|
12122
|
+
if (unmutePlayOnStart) {
|
|
12123
|
+
remoteVideo.muted = false;
|
|
12124
|
+
}
|
|
12125
|
+
})["catch"](function (e) {
|
|
12035
12126
|
if (validBrowsers.includes(browserDetails.browser)) {
|
|
12036
12127
|
//WCS-1698. fixed autoplay in chromium based browsers
|
|
12037
12128
|
//WCS-2375. fixed autoplay in ios safari
|
|
@@ -12800,14 +12891,12 @@ var loadOrdinaryVideo = function loadOrdinaryVideo(display, stream, screenShare,
|
|
|
12800
12891
|
var vEl = video;
|
|
12801
12892
|
|
|
12802
12893
|
if (!vEl) {
|
|
12803
|
-
vEl =
|
|
12894
|
+
vEl = createVideoElement();
|
|
12804
12895
|
display.appendChild(vEl);
|
|
12805
12896
|
}
|
|
12806
12897
|
|
|
12807
12898
|
vEl.id = uuid_v1() + LOCAL_CACHED_VIDEO;
|
|
12808
|
-
vEl.srcObject = stream;
|
|
12809
|
-
|
|
12810
|
-
vEl.muted = true;
|
|
12899
|
+
vEl.srcObject = stream;
|
|
12811
12900
|
|
|
12812
12901
|
vEl.onloadedmetadata = function (e) {
|
|
12813
12902
|
//WCS-2751 Add screen capture using getDisplayMedia in Safari
|
|
@@ -13183,6 +13272,19 @@ function getCacheInstance(display) {
|
|
|
13183
13272
|
}
|
|
13184
13273
|
}
|
|
13185
13274
|
|
|
13275
|
+
function createVideoElement() {
|
|
13276
|
+
var video = document.createElement('video'); // Prepare video tag to auto play and add specific Safari tweaks #WCS-2425
|
|
13277
|
+
|
|
13278
|
+
video.muted = true;
|
|
13279
|
+
|
|
13280
|
+
if (util.Browser.isSafariWebRTC()) {
|
|
13281
|
+
video.setAttribute("playsinline", "");
|
|
13282
|
+
video.setAttribute("webkit-playsinline", "");
|
|
13283
|
+
}
|
|
13284
|
+
|
|
13285
|
+
return video;
|
|
13286
|
+
}
|
|
13287
|
+
|
|
13186
13288
|
function removeVideoElement(video) {
|
|
13187
13289
|
if (video.srcObject) {
|
|
13188
13290
|
//pause
|
|
@@ -13416,7 +13518,9 @@ var playFirstVideo = function playFirstVideo(display, isLocal, src) {
|
|
|
13416
13518
|
if (!getCacheInstance(display)) {
|
|
13417
13519
|
var video = document.createElement('video');
|
|
13418
13520
|
video.setAttribute("playsinline", "");
|
|
13419
|
-
video.setAttribute("webkit-playsinline", "");
|
|
13521
|
+
video.setAttribute("webkit-playsinline", ""); //Mute video tag to prevent local audio playback in Safari #WCS-3430
|
|
13522
|
+
|
|
13523
|
+
video.muted = true;
|
|
13420
13524
|
video.id = uuid_v1() + (isLocal ? LOCAL_CACHED_VIDEO : REMOTE_CACHED_VIDEO); //in WCS-1560 we removed video.play() call, because it triggers the “Unhandled Promise Rejection” exception in iOS Safari
|
|
13421
13525
|
//in WCS-2160 we rolled back the changes made in WCS-1560 due to no audio on first playback in iOS Safari
|
|
13422
13526
|
|