@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
|
@@ -10384,6 +10384,9 @@ var getSession = function getSession(id) {
|
|
|
10384
10384
|
* @param {Object=} options.sipOptions Sip configuration
|
|
10385
10385
|
* @param {Object=} options.mediaOptions Media connection configuration
|
|
10386
10386
|
* @param {Integer=} options.timeout Connection timeout in milliseconds
|
|
10387
|
+
* @param {Integer=} options.pingInterval Server ping interval in milliseconds [0]
|
|
10388
|
+
* @param {Integer=} options.receiveProbes A maximum subsequental pings received missing count [0]
|
|
10389
|
+
* @param {Integer=} options.probesInterval Interval to check subsequental pings received [0]
|
|
10387
10390
|
* @returns {Session} Created session
|
|
10388
10391
|
* @throws {Error} Error if API is not initialized
|
|
10389
10392
|
* @throws {TypeError} Error if options.urlServer is not specified
|
|
@@ -10410,6 +10413,8 @@ var createSession = function createSession(options) {
|
|
|
10410
10413
|
var mediaOptions = options.mediaOptions;
|
|
10411
10414
|
var keepAlive = options.keepAlive;
|
|
10412
10415
|
var timeout = options.timeout;
|
|
10416
|
+
var wsPingSender = new WSPingSender(options.pingInterval || 0);
|
|
10417
|
+
var wsPingReceiver = new WSPingReceiver(options.receiveProbes || 0, options.probesInterval || 0);
|
|
10413
10418
|
var connectionTimeout;
|
|
10414
10419
|
var cConfig; //SIP config
|
|
10415
10420
|
|
|
@@ -10527,7 +10532,7 @@ var createSession = function createSession(options) {
|
|
|
10527
10532
|
mediaProviders: Object.keys(MediaProvider),
|
|
10528
10533
|
keepAlive: keepAlive,
|
|
10529
10534
|
authToken: authToken,
|
|
10530
|
-
clientVersion: "2.0.
|
|
10535
|
+
clientVersion: "2.0.212",
|
|
10531
10536
|
clientOSVersion: window.navigator.appVersion,
|
|
10532
10537
|
clientBrowserVersion: window.navigator.userAgent,
|
|
10533
10538
|
msePacketizationVersion: 2,
|
|
@@ -10540,7 +10545,11 @@ var createSession = function createSession(options) {
|
|
|
10540
10545
|
|
|
10541
10546
|
|
|
10542
10547
|
send("connection", cConfig);
|
|
10543
|
-
logger.setConnection(wsConnection);
|
|
10548
|
+
logger.setConnection(wsConnection); // Send ping messages to server to check if connection is still alive #WCS-3410
|
|
10549
|
+
|
|
10550
|
+
wsPingSender.start(); // Check subsequintel pings received from server to check if connection is still alive #WCS-3410
|
|
10551
|
+
|
|
10552
|
+
wsPingReceiver.start();
|
|
10544
10553
|
};
|
|
10545
10554
|
|
|
10546
10555
|
wsConnection.onmessage = function (event) {
|
|
@@ -10556,6 +10565,7 @@ var createSession = function createSession(options) {
|
|
|
10556
10565
|
switch (data.message) {
|
|
10557
10566
|
case 'ping':
|
|
10558
10567
|
send("pong", null);
|
|
10568
|
+
wsPingReceiver.success();
|
|
10559
10569
|
break;
|
|
10560
10570
|
|
|
10561
10571
|
case 'getUserData':
|
|
@@ -10715,7 +10725,11 @@ var createSession = function createSession(options) {
|
|
|
10715
10725
|
sessionStatus = newStatus;
|
|
10716
10726
|
|
|
10717
10727
|
if (sessionStatus == SESSION_STATUS.DISCONNECTED || sessionStatus == SESSION_STATUS.FAILED) {
|
|
10718
|
-
//
|
|
10728
|
+
// Stop pinging server #WCS-3410
|
|
10729
|
+
wsPingSender.stop(); // Stop checking pings received #WCS-3410
|
|
10730
|
+
|
|
10731
|
+
wsPingReceiver.stop(); //remove streams
|
|
10732
|
+
|
|
10719
10733
|
for (var prop in streamRefreshHandlers) {
|
|
10720
10734
|
if (streamRefreshHandlers.hasOwnProperty(prop) && typeof streamRefreshHandlers[prop] === 'function') {
|
|
10721
10735
|
streamRefreshHandlers[prop]({
|
|
@@ -10731,6 +10745,73 @@ var createSession = function createSession(options) {
|
|
|
10731
10745
|
if (callbacks[sessionStatus]) {
|
|
10732
10746
|
callbacks[sessionStatus](session, obj);
|
|
10733
10747
|
}
|
|
10748
|
+
} // Websocket periodic ping sender
|
|
10749
|
+
|
|
10750
|
+
|
|
10751
|
+
function WSPingSender(interval) {
|
|
10752
|
+
this.interval = interval || 0;
|
|
10753
|
+
this.intervalId = null;
|
|
10754
|
+
|
|
10755
|
+
this.start = function () {
|
|
10756
|
+
if (this.interval > 0) {
|
|
10757
|
+
this.intervalId = setInterval(function () {
|
|
10758
|
+
send("ping", null);
|
|
10759
|
+
}, this.interval);
|
|
10760
|
+
}
|
|
10761
|
+
};
|
|
10762
|
+
|
|
10763
|
+
this.stop = function () {
|
|
10764
|
+
if (this.intervalId) {
|
|
10765
|
+
clearInterval(this.intervalId);
|
|
10766
|
+
}
|
|
10767
|
+
};
|
|
10768
|
+
|
|
10769
|
+
return this;
|
|
10770
|
+
} // Websocket ping receive prober
|
|
10771
|
+
|
|
10772
|
+
|
|
10773
|
+
function WSPingReceiver(receiveProbes, probesInterval) {
|
|
10774
|
+
this.maxPings = receiveProbes || 0;
|
|
10775
|
+
this.interval = probesInterval || 0;
|
|
10776
|
+
this.intervalId = null;
|
|
10777
|
+
this.pingsMissing = 0;
|
|
10778
|
+
|
|
10779
|
+
this.start = function () {
|
|
10780
|
+
if (this.maxPings > 0 && this.interval > 0) {
|
|
10781
|
+
var receiver = this;
|
|
10782
|
+
this.intervalId = setInterval(function () {
|
|
10783
|
+
receiver.checkPingsReceived();
|
|
10784
|
+
}, this.interval);
|
|
10785
|
+
}
|
|
10786
|
+
};
|
|
10787
|
+
|
|
10788
|
+
this.stop = function () {
|
|
10789
|
+
if (this.intervalId) {
|
|
10790
|
+
clearInterval(this.intervalId);
|
|
10791
|
+
}
|
|
10792
|
+
|
|
10793
|
+
this.pingsMissing = 0;
|
|
10794
|
+
};
|
|
10795
|
+
|
|
10796
|
+
this.checkPingsReceived = function () {
|
|
10797
|
+
this.pingsMissing++;
|
|
10798
|
+
|
|
10799
|
+
if (this.pingsMissing >= this.maxPings) {
|
|
10800
|
+
this.failure();
|
|
10801
|
+
}
|
|
10802
|
+
};
|
|
10803
|
+
|
|
10804
|
+
this.success = function () {
|
|
10805
|
+
this.pingsMissing = 0;
|
|
10806
|
+
};
|
|
10807
|
+
|
|
10808
|
+
this.failure = function () {
|
|
10809
|
+
logger.info(LOG_PREFIX, "Missing " + this.pingsMissing + " pings from server, connection seems to be down");
|
|
10810
|
+
onSessionStatusChange(SESSION_STATUS.FAILED);
|
|
10811
|
+
wsConnection.close();
|
|
10812
|
+
};
|
|
10813
|
+
|
|
10814
|
+
return this;
|
|
10734
10815
|
}
|
|
10735
10816
|
/**
|
|
10736
10817
|
* @callback sdpHook
|
|
@@ -11595,7 +11676,7 @@ var createSession = function createSession(options) {
|
|
|
11595
11676
|
* @param {HTMLElement} options.display Div element stream should be displayed in
|
|
11596
11677
|
* @param {Object=} options.custom User provided custom object that will be available in REST App code
|
|
11597
11678
|
* @param {Integer} [options.flashBufferTime=0] Specifies how long to buffer messages before starting to display the stream (Flash-only)
|
|
11598
|
-
* @param {
|
|
11679
|
+
* @param {string=} options.stripCodecs Comma separated string of codecs which should be stripped from WebRTC SDP (ex. "H264,PCMA,PCMU,G722")
|
|
11599
11680
|
* @param {string=} options.rtmpUrl Rtmp url stream should be forwarded to
|
|
11600
11681
|
* @param {Object=} options.mediaConnectionConstraints Stream specific constraints for underlying RTCPeerConnection
|
|
11601
11682
|
* @param {Boolean=} options.flashShowFullScreenButton Show full screen button in flash
|
|
@@ -11604,6 +11685,7 @@ var createSession = function createSession(options) {
|
|
|
11604
11685
|
* @param {Integer=} options.playoutDelay Time delay between network reception of media and playout
|
|
11605
11686
|
* @param {string=} options.useCanvasMediaStream EXPERIMENTAL: when publish bind browser's media stream to the canvas. It can be useful for image filtering
|
|
11606
11687
|
* @param {string=} options.videoContentHint Video content hint for browser ('detail' by default to maintain resolution), {@link Flashphoner.constants.CONTENT_HINT_TYPE}
|
|
11688
|
+
* @param {Boolean=} options.unmutePlayOnStart Unmute playback on start. May be used after user gesture only, so set 'unmutePlayOnStart: false' for autoplay
|
|
11607
11689
|
* @param {sdpHook} sdpHook The callback that handles sdp from the server
|
|
11608
11690
|
* @returns {Stream} Stream
|
|
11609
11691
|
* @throws {TypeError} Error if no options provided
|
|
@@ -11715,6 +11797,7 @@ var createSession = function createSession(options) {
|
|
|
11715
11797
|
var playoutDelay = options.playoutDelay;
|
|
11716
11798
|
var useCanvasMediaStream = options.useCanvasMediaStream;
|
|
11717
11799
|
var videoContentHint = options.videoContentHint;
|
|
11800
|
+
var unmutePlayOnStart = options.unmutePlayOnStart;
|
|
11718
11801
|
var audioState_;
|
|
11719
11802
|
var videoState_;
|
|
11720
11803
|
var connectionQuality;
|
|
@@ -11891,7 +11974,8 @@ var createSession = function createSession(options) {
|
|
|
11891
11974
|
connectionConstraints: mediaConnectionConstraints,
|
|
11892
11975
|
audioOutputId: audioOutputId,
|
|
11893
11976
|
remoteVideo: remoteVideo,
|
|
11894
|
-
playoutDelay: playoutDelay
|
|
11977
|
+
playoutDelay: playoutDelay,
|
|
11978
|
+
unmutePlayOnStart: unmutePlayOnStart
|
|
11895
11979
|
}, streamRefreshHandlers[id_]).then(function (newConnection) {
|
|
11896
11980
|
mediaConnection = newConnection;
|
|
11897
11981
|
|
|
@@ -13419,7 +13503,9 @@ var createConnection = function createConnection(options) {
|
|
|
13419
13503
|
var screenShare = false;
|
|
13420
13504
|
var playoutDelay = options.playoutDelay; // Set video track contentHint to `detail` by default to workaround Chromium 91 bug #WCS-3257
|
|
13421
13505
|
|
|
13422
|
-
var videoContentHint = options.videoContentHint ? options.videoContentHint : 'detail';
|
|
13506
|
+
var videoContentHint = options.videoContentHint ? options.videoContentHint : 'detail'; // Pass the option to unmute automatically (true by default) #WCS-2425
|
|
13507
|
+
|
|
13508
|
+
var unmutePlayOnStart = options.unmutePlayOnStart !== undefined ? options.unmutePlayOnStart : true;
|
|
13423
13509
|
|
|
13424
13510
|
if (bidirectional) {
|
|
13425
13511
|
localVideo = getCacheInstance(localDisplay);
|
|
@@ -13438,7 +13524,7 @@ var createConnection = function createConnection(options) {
|
|
|
13438
13524
|
remoteVideo = getCacheInstance(remoteDisplay);
|
|
13439
13525
|
|
|
13440
13526
|
if (!remoteVideo) {
|
|
13441
|
-
remoteVideo =
|
|
13527
|
+
remoteVideo = createVideoElement();
|
|
13442
13528
|
remoteDisplay.appendChild(remoteVideo);
|
|
13443
13529
|
}
|
|
13444
13530
|
|
|
@@ -13463,7 +13549,7 @@ var createConnection = function createConnection(options) {
|
|
|
13463
13549
|
if (cachedVideo) {
|
|
13464
13550
|
remoteVideo = cachedVideo;
|
|
13465
13551
|
} else {
|
|
13466
|
-
remoteVideo =
|
|
13552
|
+
remoteVideo = createVideoElement();
|
|
13467
13553
|
display.appendChild(remoteVideo);
|
|
13468
13554
|
}
|
|
13469
13555
|
|
|
@@ -13527,7 +13613,12 @@ var createConnection = function createConnection(options) {
|
|
|
13527
13613
|
|
|
13528
13614
|
remoteVideo.onloadedmetadata = function (e) {
|
|
13529
13615
|
if (remoteVideo) {
|
|
13530
|
-
remoteVideo.play()
|
|
13616
|
+
remoteVideo.play().then(function () {
|
|
13617
|
+
// Automatically unmute video if needed #WCS-2425
|
|
13618
|
+
if (unmutePlayOnStart) {
|
|
13619
|
+
remoteVideo.muted = false;
|
|
13620
|
+
}
|
|
13621
|
+
})["catch"](function (e) {
|
|
13531
13622
|
if (validBrowsers.includes(browserDetails.browser)) {
|
|
13532
13623
|
//WCS-1698. fixed autoplay in chromium based browsers
|
|
13533
13624
|
//WCS-2375. fixed autoplay in ios safari
|
|
@@ -14296,14 +14387,12 @@ var loadOrdinaryVideo = function loadOrdinaryVideo(display, stream, screenShare,
|
|
|
14296
14387
|
var vEl = video;
|
|
14297
14388
|
|
|
14298
14389
|
if (!vEl) {
|
|
14299
|
-
vEl =
|
|
14390
|
+
vEl = createVideoElement();
|
|
14300
14391
|
display.appendChild(vEl);
|
|
14301
14392
|
}
|
|
14302
14393
|
|
|
14303
14394
|
vEl.id = uuid_v1() + LOCAL_CACHED_VIDEO;
|
|
14304
|
-
vEl.srcObject = stream;
|
|
14305
|
-
|
|
14306
|
-
vEl.muted = true;
|
|
14395
|
+
vEl.srcObject = stream;
|
|
14307
14396
|
|
|
14308
14397
|
vEl.onloadedmetadata = function (e) {
|
|
14309
14398
|
//WCS-2751 Add screen capture using getDisplayMedia in Safari
|
|
@@ -14679,6 +14768,19 @@ function getCacheInstance(display) {
|
|
|
14679
14768
|
}
|
|
14680
14769
|
}
|
|
14681
14770
|
|
|
14771
|
+
function createVideoElement() {
|
|
14772
|
+
var video = document.createElement('video'); // Prepare video tag to auto play and add specific Safari tweaks #WCS-2425
|
|
14773
|
+
|
|
14774
|
+
video.muted = true;
|
|
14775
|
+
|
|
14776
|
+
if (util.Browser.isSafariWebRTC()) {
|
|
14777
|
+
video.setAttribute("playsinline", "");
|
|
14778
|
+
video.setAttribute("webkit-playsinline", "");
|
|
14779
|
+
}
|
|
14780
|
+
|
|
14781
|
+
return video;
|
|
14782
|
+
}
|
|
14783
|
+
|
|
14682
14784
|
function removeVideoElement(video) {
|
|
14683
14785
|
if (video.srcObject) {
|
|
14684
14786
|
//pause
|
|
@@ -14912,7 +15014,9 @@ var playFirstVideo = function playFirstVideo(display, isLocal, src) {
|
|
|
14912
15014
|
if (!getCacheInstance(display)) {
|
|
14913
15015
|
var video = document.createElement('video');
|
|
14914
15016
|
video.setAttribute("playsinline", "");
|
|
14915
|
-
video.setAttribute("webkit-playsinline", "");
|
|
15017
|
+
video.setAttribute("webkit-playsinline", ""); //Mute video tag to prevent local audio playback in Safari #WCS-3430
|
|
15018
|
+
|
|
15019
|
+
video.muted = true;
|
|
14916
15020
|
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
|
|
14917
15021
|
//in WCS-2160 we rolled back the changes made in WCS-1560 due to no audio on first playback in iOS Safari
|
|
14918
15022
|
|