@flashphoner/websdk 2.0.223 → 2.0.224
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/embed_player/images/stop.png +0 -0
- package/examples/demo/streaming/embed_player/player.css +11 -1
- package/examples/demo/streaming/embed_player/player.js +101 -20
- package/examples/demo/streaming/player/player.js +25 -2
- package/flashphoner-no-flash.js +917 -2891
- package/flashphoner-no-flash.min.js +2 -2
- package/flashphoner-no-webrtc.js +790 -2596
- package/flashphoner-no-webrtc.min.js +2 -2
- package/flashphoner-no-wsplayer.js +910 -2582
- package/flashphoner-no-wsplayer.min.js +2 -2
- package/flashphoner-room-api.js +109 -19
- package/flashphoner-room-api.min.js +2 -2
- package/flashphoner-temasys-flash-websocket-without-adapterjs.js +840 -2840
- package/flashphoner-temasys-flash-websocket.js +839 -2839
- package/flashphoner-temasys-flash-websocket.min.js +1 -1
- package/flashphoner-webrtc-only.js +910 -2582
- package/flashphoner-webrtc-only.min.js +1 -1
- package/flashphoner.js +917 -2891
- package/flashphoner.min.js +2 -2
- package/package.json +1 -1
- package/src/flashphoner-core.js +9 -1
- package/src/util.js +40 -2
- package/src/webrtc-media-provider.js +60 -16
package/docTemplate/README.md
CHANGED
|
Binary file
|
|
@@ -73,8 +73,8 @@ video:-webkit-full-screen {
|
|
|
73
73
|
top: 50%;
|
|
74
74
|
left: 50%;
|
|
75
75
|
transform: translate(-50%, -50%) scale(1);
|
|
76
|
-
background: #00CBFF;
|
|
77
76
|
border-radius: 26%;
|
|
77
|
+
z-index: 2147483647 !important;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
#play img {
|
|
@@ -82,6 +82,16 @@ video:-webkit-full-screen {
|
|
|
82
82
|
width: 100%;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
.play {
|
|
86
|
+
background: #00CBFF;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.stop {
|
|
90
|
+
-webkit-box-shadow: inset 0px 1px 29px 0px rgba(102, 31, 36, 0.75);
|
|
91
|
+
-moz-box-shadow: inset 0px 1px 29px 0px rgba(102, 31, 36, 0.75);
|
|
92
|
+
box-shadow: inset 0px 1px 29px 0px rgba(102, 31, 36, 0.75);
|
|
93
|
+
}
|
|
94
|
+
|
|
85
95
|
#play:hover {
|
|
86
96
|
transform: translate(-50%, -50%) scale(1.05);
|
|
87
97
|
-webkit-box-shadow: inset 0px 1px 29px 0px rgba(102, 31, 36, 0.75);
|
|
@@ -18,6 +18,7 @@ const HTML_VOLUME_LOW='<svg height="100%" version="1.1" viewBox="0 0 36 36" widt
|
|
|
18
18
|
const HTML_VOLUME_HIGH='<svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"<defs><clipPath><path d="m 14.35,-0.14 -5.86,5.86 20.73,20.78 5.86,-5.91 z"></path><path d="M 7.07,6.87 -1.11,15.33 19.61,36.11 27.80,27.60 z"></path><path d="M 9.09,5.20 6.47,7.88 26.82,28.77 29.66,25.99 z" transform="translate(0, 0)"></path></clipPath><clipPath><path d="m -11.45,-15.55 -4.44,4.51 20.45,20.94 4.55,-4.66 z" transform="translate(0, 0)"></path></clipPath></defs><path style="fill: #fff;" clip-path="url(#ytp-svg-volume-animation-mask)" d="M8,21 L12,21 L17,26 L17,10 L12,15 L8,15 L8,21 Z M19,14 L19,22 C20.48,21.32 21.5,19.77 21.5,18 C21.5,16.26 20.48,14.74 19,14 ZM19,11.29 C21.89,12.15 24,14.83 24,18 C24,21.17 21.89,23.85 19,24.71 L19,26.77 C23.01,25.86 26,22.28 26,18 C26,13.72 23.01,10.14 19,9.23 L19,11.29 Z" fill="#fff" id="ytp-svg-12"></path></svg>';
|
|
19
19
|
const HTML_FULLSCREEN_EXIT='<svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><g class="ytp-fullscreen-button-corner-2"><path style="fill: #fff;" d="m 14,14 -4,0 0,2 6,0 0,-6 -2,0 0,4 0,0 z"></path></g><g><path style="fill: #fff;" d="m 22,14 0,-4 -2,0 0,6 6,0 0,-2 -4,0 0,0 z"></path></g><g><path style="fill: #fff;" d="m 20,26 2,0 0,-4 4,0 0,-2 -6,0 0,6 0,0 z"></path></g><g><path style="fill: #fff;" d="m 10,22 4,0 0,4 2,0 0,-6 -6,0 0,2 0,0 z"></path></g></svg>';
|
|
20
20
|
let firstUnmuted = true;
|
|
21
|
+
let useVideoControls = false;
|
|
21
22
|
|
|
22
23
|
function init_page() {
|
|
23
24
|
//video display
|
|
@@ -45,9 +46,13 @@ function init_page() {
|
|
|
45
46
|
$(".fullscreen").hide();
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
if ((Browser.isSafariWebRTC() &&
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
if ((Browser.isSafariWebRTC() && Flashphoner.getMediaProviders()[0] == "WebRTC")) {
|
|
50
|
+
if (Browser.version() > 13) {
|
|
51
|
+
// Enable video controls for fullscreen mode to work in Safari
|
|
52
|
+
useVideoControls = true;
|
|
53
|
+
// Hide custom controls
|
|
54
|
+
$('.player').hide();
|
|
55
|
+
}
|
|
51
56
|
}
|
|
52
57
|
if (autoplay ) {
|
|
53
58
|
// Autoplay will start for muted video tag only, adjust mute button and slider view
|
|
@@ -61,7 +66,8 @@ function init_page() {
|
|
|
61
66
|
|
|
62
67
|
function onStarted(stream) {
|
|
63
68
|
stopped = false;
|
|
64
|
-
|
|
69
|
+
centralButton.setView("stop");
|
|
70
|
+
centralButton.hide();
|
|
65
71
|
$(".play-pause").prop('disabled', false);
|
|
66
72
|
$(".fullscreen").prop('disabled', false);
|
|
67
73
|
stream.setVolume(currentVolumeValue);
|
|
@@ -69,13 +75,15 @@ function onStarted(stream) {
|
|
|
69
75
|
|
|
70
76
|
function onStopped() {
|
|
71
77
|
stopped = true;
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
centralButton.stopTimer();
|
|
79
|
+
centralButton.setView("play");
|
|
80
|
+
centralButton.display();
|
|
81
|
+
centralButton.setAction(function() {
|
|
74
82
|
if (!$('.play-pause').prop('disabled')) {
|
|
75
83
|
if (stopped) {
|
|
76
84
|
start();
|
|
77
85
|
$('.play-pause').addClass('pause').removeClass('play').prop('disabled', true);
|
|
78
|
-
|
|
86
|
+
centralButton.hide();
|
|
79
87
|
} else {
|
|
80
88
|
if (stream) {
|
|
81
89
|
stream.stop();
|
|
@@ -96,7 +104,7 @@ function start() {
|
|
|
96
104
|
if (Flashphoner.getMediaProviders()[0] == "WSPlayer") {
|
|
97
105
|
Flashphoner.playFirstSound();
|
|
98
106
|
} else if (Browser.isSafariWebRTC() || Flashphoner.getMediaProviders()[0] == "MSE") {
|
|
99
|
-
Flashphoner.playFirstVideo(remoteVideo, false, PRELOADER_URL).then(function() {
|
|
107
|
+
Flashphoner.playFirstVideo(remoteVideo, false, PRELOADER_URL, useVideoControls).then(function() {
|
|
100
108
|
createSession();
|
|
101
109
|
}).catch(function() {
|
|
102
110
|
onStopped();
|
|
@@ -133,7 +141,8 @@ function playStream(session) {
|
|
|
133
141
|
var options = {
|
|
134
142
|
name: streamName,
|
|
135
143
|
display: remoteVideo,
|
|
136
|
-
flashShowFullScreenButton: true
|
|
144
|
+
flashShowFullScreenButton: true,
|
|
145
|
+
useControls: useVideoControls
|
|
137
146
|
};
|
|
138
147
|
if (resolution_for_wsplayer) {
|
|
139
148
|
options.playWidth = resolution_for_wsplayer.playWidth;
|
|
@@ -163,6 +172,21 @@ function playStream(session) {
|
|
|
163
172
|
resizeVideo(event.target, options.playWidth, newHeight);
|
|
164
173
|
}
|
|
165
174
|
});
|
|
175
|
+
if (useVideoControls && Browser.isSafariWebRTC()) {
|
|
176
|
+
// iOS/MacOS hack when using standard controls to leave fullscreen mode
|
|
177
|
+
var needRestart = false;
|
|
178
|
+
video.addEventListener("pause", function () {
|
|
179
|
+
if(needRestart) {
|
|
180
|
+
console.log("Video paused after fullscreen, continue...");
|
|
181
|
+
video.play();
|
|
182
|
+
needRestart = false;
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
video.addEventListener("webkitendfullscreen", function () {
|
|
186
|
+
video.play();
|
|
187
|
+
needRestart = true;
|
|
188
|
+
});
|
|
189
|
+
}
|
|
166
190
|
}
|
|
167
191
|
}).on(STREAM_STATUS.PLAYING, function (stream) {
|
|
168
192
|
setStatus(stream.status());
|
|
@@ -263,6 +287,51 @@ function setVolume(volume, slider) {
|
|
|
263
287
|
return(true);
|
|
264
288
|
}
|
|
265
289
|
|
|
290
|
+
// Object to manage central Play/Stop button
|
|
291
|
+
centralButton = {
|
|
292
|
+
timer: null,
|
|
293
|
+
displayed: false,
|
|
294
|
+
display: function(timeout = 0) {
|
|
295
|
+
$('#play').show();
|
|
296
|
+
centralButton.displayed = true;
|
|
297
|
+
if (timeout > 0 && !centralButton.timer) {
|
|
298
|
+
centralButton.timer = setTimeout(function() {
|
|
299
|
+
centralButton.hide();
|
|
300
|
+
}, timeout);
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
displayToggle: function(timeout) {
|
|
304
|
+
if(!centralButton.displayed) {
|
|
305
|
+
centralButton.display(timeout);
|
|
306
|
+
} else {
|
|
307
|
+
centralButton.hide();
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
setAction: function(action) {
|
|
311
|
+
$('#play').on('click', action);
|
|
312
|
+
},
|
|
313
|
+
setView: function(view) {
|
|
314
|
+
if (view === "play") {
|
|
315
|
+
$('#play').addClass('play').removeClass('stop');
|
|
316
|
+
$('#play img').prop('src', 'images/play.png');
|
|
317
|
+
} else if (view === "stop") {
|
|
318
|
+
$('#play').addClass('stop').removeClass('play');
|
|
319
|
+
$('#play img').prop('src', 'images/stop.png');
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
hide: function() {
|
|
323
|
+
$('#play').hide();
|
|
324
|
+
centralButton.displayed = false;
|
|
325
|
+
centralButton.stopTimer();
|
|
326
|
+
},
|
|
327
|
+
stopTimer: function() {
|
|
328
|
+
if (centralButton.timer) {
|
|
329
|
+
clearTimeout(centralButton.timer);
|
|
330
|
+
centralButton.timer = null;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
|
|
266
335
|
(function ($) {
|
|
267
336
|
$.fn.videoPlayer = function (options) {
|
|
268
337
|
var settings = {
|
|
@@ -299,7 +368,7 @@ function setVolume(volume, slider) {
|
|
|
299
368
|
if (stopped) {
|
|
300
369
|
start();
|
|
301
370
|
$(this).addClass('pause').removeClass('play').prop('disabled', true);
|
|
302
|
-
|
|
371
|
+
centralButton.hide();
|
|
303
372
|
} else {
|
|
304
373
|
if (stream) {
|
|
305
374
|
stream.stop();
|
|
@@ -310,18 +379,20 @@ function setVolume(volume, slider) {
|
|
|
310
379
|
}
|
|
311
380
|
});
|
|
312
381
|
|
|
382
|
+
|
|
313
383
|
$that.bind('click', function () {
|
|
314
384
|
if ( !stopped ) {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
$
|
|
321
|
-
|
|
385
|
+
if ($clearTimeout) {
|
|
386
|
+
clearTimeout($clearTimeout);
|
|
387
|
+
}
|
|
388
|
+
centralButton.displayToggle(5000);
|
|
389
|
+
$that.find('.player').stop(true, false).animate({'opacity': '1'}, 0.5);
|
|
390
|
+
$clearTimeout = setTimeout(function() {
|
|
391
|
+
$that.find('.player').stop(true, false).animate({'opacity': '0'}, 0.5);
|
|
392
|
+
}, 5000);
|
|
322
393
|
};
|
|
323
394
|
});
|
|
324
|
-
|
|
395
|
+
|
|
325
396
|
$that.find('.volume').hover(function () {
|
|
326
397
|
$volhover = true;
|
|
327
398
|
}, function () {
|
|
@@ -330,10 +401,17 @@ function setVolume(volume, slider) {
|
|
|
330
401
|
|
|
331
402
|
$('body, html').bind('mousemove', function (e) {
|
|
332
403
|
if ( !stopped ) {
|
|
404
|
+
// Prevent central button displaying by mousemove in mobile browsers
|
|
405
|
+
if (!(Browser.isAndroid() || Browser.isiOS())) {
|
|
406
|
+
centralButton.display(5000);
|
|
407
|
+
}
|
|
333
408
|
$that.hover(function () {
|
|
334
409
|
$that.find('.player').stop(true, false).animate({'opacity': '1'}, 0.5);
|
|
335
410
|
}, function () {
|
|
336
411
|
$that.find('.player').stop(true, false).animate({'opacity': '0'}, 0.5);
|
|
412
|
+
if (!stopped) {
|
|
413
|
+
centralButton.hide();
|
|
414
|
+
}
|
|
337
415
|
});
|
|
338
416
|
}
|
|
339
417
|
if (!$volhover) {
|
|
@@ -430,11 +508,11 @@ function setVolume(volume, slider) {
|
|
|
430
508
|
|
|
431
509
|
$(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange', function(e) {
|
|
432
510
|
if (stream) {
|
|
433
|
-
|
|
511
|
+
|
|
434
512
|
$('.player').toggleClass('fullscreenon'); //Add class for all controls in full screen mode
|
|
435
513
|
$('.volume-range-block').toggleClass('fullscreen-vol'); //Add class to volume control for full screen mode
|
|
436
514
|
|
|
437
|
-
if (
|
|
515
|
+
if ( e.target === document.fullscreenElement ) {
|
|
438
516
|
prevFull = $('.fullscreenBtn').html();
|
|
439
517
|
|
|
440
518
|
//change full screen button to full screen exit button
|
|
@@ -450,6 +528,7 @@ function setVolume(volume, slider) {
|
|
|
450
528
|
$that.find('.player').stop(true, false).animate({'opacity': '0'}, 0.5);
|
|
451
529
|
}, 15000);
|
|
452
530
|
});
|
|
531
|
+
|
|
453
532
|
} else {
|
|
454
533
|
|
|
455
534
|
$('.fullscreenBtn').html(prevFull);
|
|
@@ -459,6 +538,8 @@ function setVolume(volume, slider) {
|
|
|
459
538
|
};
|
|
460
539
|
});
|
|
461
540
|
};
|
|
541
|
+
// Resize video to a parent tag when toggling fullscreen (we may not receive `resize` event in Safari 16) #WCS-3606
|
|
542
|
+
resizeVideo(e.target);
|
|
462
543
|
};
|
|
463
544
|
});
|
|
464
545
|
});
|
|
@@ -14,6 +14,8 @@ var resolution = getUrlParam("resolution");
|
|
|
14
14
|
var mediaProvider = getUrlParam("mediaProvider") || null;
|
|
15
15
|
var mseCutByIFrameOnly = getUrlParam("mseCutByIFrameOnly");
|
|
16
16
|
|
|
17
|
+
var useVideoControls = false;
|
|
18
|
+
|
|
17
19
|
function init_page() {
|
|
18
20
|
|
|
19
21
|
//init api
|
|
@@ -56,6 +58,11 @@ function init_page() {
|
|
|
56
58
|
$("#volumeControl").slider('value', 0);
|
|
57
59
|
$("#playBtn").click();
|
|
58
60
|
}
|
|
61
|
+
// Enable video controls for fullscreen mode to work in Safari 16
|
|
62
|
+
if (Browser.isSafariWebRTC() && Browser.version() > 13) {
|
|
63
|
+
useVideoControls = true;
|
|
64
|
+
$("#fullScreen").hide();
|
|
65
|
+
}
|
|
59
66
|
}
|
|
60
67
|
|
|
61
68
|
function onStarted(stream) {
|
|
@@ -87,7 +94,7 @@ function playBtnClick() {
|
|
|
87
94
|
if (Flashphoner.getMediaProviders()[0] === "WSPlayer") {
|
|
88
95
|
Flashphoner.playFirstSound();
|
|
89
96
|
} else if (Browser.isSafariWebRTC() || Flashphoner.getMediaProviders()[0] === "MSE") {
|
|
90
|
-
Flashphoner.playFirstVideo(remoteVideo, false, PRELOADER_URL).then(function() {
|
|
97
|
+
Flashphoner.playFirstVideo(remoteVideo, false, PRELOADER_URL, useVideoControls).then(function() {
|
|
91
98
|
start();
|
|
92
99
|
}).catch(function () {
|
|
93
100
|
onStopped();
|
|
@@ -134,7 +141,8 @@ function playStream(session) {
|
|
|
134
141
|
var options = {
|
|
135
142
|
name: streamName,
|
|
136
143
|
display: remoteVideo,
|
|
137
|
-
flashShowFullScreenButton: true
|
|
144
|
+
flashShowFullScreenButton: true,
|
|
145
|
+
useControls: useVideoControls
|
|
138
146
|
};
|
|
139
147
|
if (Flashphoner.getMediaProviders()[0] === "MSE" && mseCutByIFrameOnly) {
|
|
140
148
|
options.mediaConnectionConstraints = {
|
|
@@ -171,6 +179,21 @@ function playStream(session) {
|
|
|
171
179
|
}
|
|
172
180
|
});
|
|
173
181
|
}
|
|
182
|
+
if (useVideoControls && Browser.isSafariWebRTC()) {
|
|
183
|
+
// iOS hack when using standard controls to leave fullscreen mode
|
|
184
|
+
var needRestart = false;
|
|
185
|
+
video.addEventListener("pause", function () {
|
|
186
|
+
if(needRestart) {
|
|
187
|
+
console.log("Video paused after fullscreen, continue...");
|
|
188
|
+
video.play();
|
|
189
|
+
needRestart = false;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
video.addEventListener("webkitendfullscreen", function () {
|
|
193
|
+
video.play();
|
|
194
|
+
needRestart = true;
|
|
195
|
+
});
|
|
196
|
+
}
|
|
174
197
|
}
|
|
175
198
|
}).on(STREAM_STATUS.PLAYING, function (stream) {
|
|
176
199
|
$("#preloader").hide();
|