@flashphoner/websdk 2.0.207 → 2.0.211
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 +2 -17
- package/examples/demo/streaming/player/player.js +10 -9
- package/examples/demo/streaming/screen-sharing/screen-sharing.html +1 -1
- package/examples/demo/streaming/screen-sharing/screen-sharing.js +1 -1
- 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 +116 -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 +116 -14
- package/flashphoner-no-wsplayer.min.js +2 -2
- package/flashphoner-room-api.js +103 -10
- 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 +116 -14
- package/flashphoner-webrtc-only.min.js +1 -1
- package/flashphoner.js +116 -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 +24 -7
package/docTemplate/README.md
CHANGED
|
@@ -112,11 +112,6 @@ function playBtnClick(index) {
|
|
|
112
112
|
|
|
113
113
|
if (Flashphoner.getMediaProviders()[0] === "WSPlayer") {
|
|
114
114
|
Flashphoner.playFirstSound();
|
|
115
|
-
} else if (Browser.isSafariWebRTC()) {
|
|
116
|
-
Flashphoner.playFirstVideo(display, false, PRELOADER_URL).then(function () {
|
|
117
|
-
playStream(index, display);
|
|
118
|
-
});
|
|
119
|
-
return;
|
|
120
115
|
}
|
|
121
116
|
playStream(index, display);
|
|
122
117
|
}
|
|
@@ -39,12 +39,6 @@ function connect() {
|
|
|
39
39
|
console.log("Create new session with url " + url);
|
|
40
40
|
Flashphoner.createSession({urlServer: url}).on(SESSION_STATUS.ESTABLISHED, function (session) {
|
|
41
41
|
setStatus("#connectStatus", session.status());
|
|
42
|
-
if (Browser.isSafariWebRTC()) {
|
|
43
|
-
Flashphoner.playFirstVideo(localVideo, true, PRELOADER_URL).then(function() {
|
|
44
|
-
startStreaming();
|
|
45
|
-
});
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
42
|
startStreaming();
|
|
49
43
|
}).on(SESSION_STATUS.DISCONNECTED, function () {
|
|
50
44
|
setStatus("#connectStatus", SESSION_STATUS.DISCONNECTED);
|
|
@@ -107,12 +101,6 @@ function startStreaming() {
|
|
|
107
101
|
setStatus("#publishStatus", STREAM_STATUS.PUBLISHING);
|
|
108
102
|
if (Flashphoner.getMediaProviders()[0] === "WSPlayer") {
|
|
109
103
|
Flashphoner.playFirstSound();
|
|
110
|
-
} else if (Browser.isSafariWebRTC() || Flashphoner.getMediaProviders()[0] === "MSE") {
|
|
111
|
-
Flashphoner.playFirstVideo(remoteVideo, false, PRELOADER_URL).then(function() {
|
|
112
|
-
playStream();
|
|
113
|
-
onPublishing(stream);
|
|
114
|
-
});
|
|
115
|
-
return;
|
|
116
104
|
}
|
|
117
105
|
playStream();
|
|
118
106
|
onPublishing(stream);
|
|
@@ -66,6 +66,9 @@
|
|
|
66
66
|
<div class="text-center" style="margin-top: 20px">
|
|
67
67
|
<div id="participant1Status"></div>
|
|
68
68
|
</div>
|
|
69
|
+
<div class="input-group text-center" style="margin: 5px auto 0 auto;">
|
|
70
|
+
<button id="participant1Btn" type="button" class="btn btn-default">Play</button>
|
|
71
|
+
</div>
|
|
69
72
|
</div>
|
|
70
73
|
|
|
71
74
|
<div class="col-sm-6">
|
|
@@ -76,6 +79,9 @@
|
|
|
76
79
|
<div class="text-center" style="margin-top: 20px">
|
|
77
80
|
<div id="participant2Status"></div>
|
|
78
81
|
</div>
|
|
82
|
+
<div class="input-group text-center" style="margin: 5px auto 0 auto;">
|
|
83
|
+
<button id="participant2Btn" type="button" class="btn btn-default">Play</button>
|
|
84
|
+
</div>
|
|
79
85
|
</div>
|
|
80
86
|
|
|
81
87
|
</div>
|
|
@@ -47,6 +47,9 @@ function onLeft() {
|
|
|
47
47
|
$("[id$=Name]").not(":contains('NONE')").each(function(index,value) {
|
|
48
48
|
$(value).text('NONE');
|
|
49
49
|
});
|
|
50
|
+
for (var i = 0; i < _participants; i++) {
|
|
51
|
+
$("#participant" + i + "Btn").text("Play").off('click').prop('disabled', true);
|
|
52
|
+
};
|
|
50
53
|
$("#joinBtn").text("Join").off('click').click(function(){
|
|
51
54
|
if (validateForm()) {
|
|
52
55
|
$(this).prop('disabled', true);
|
|
@@ -75,14 +78,6 @@ function start() {
|
|
|
75
78
|
return;
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
|
-
if (Browser.isSafariWebRTC()) {
|
|
79
|
-
for (var i = 1; i < _participants; i++){
|
|
80
|
-
Flashphoner.playFirstVideo(document.getElementById("participant" + i + "Display"), false, PRELOADER_URL).then(function() {
|
|
81
|
-
createConnection(url, username);
|
|
82
|
-
});
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
81
|
createConnection(url, username);
|
|
87
82
|
}
|
|
88
83
|
|
|
@@ -123,14 +118,7 @@ function joinRoom() {
|
|
|
123
118
|
} else {
|
|
124
119
|
addMessage("chat", " room is empty");
|
|
125
120
|
}
|
|
126
|
-
|
|
127
|
-
Flashphoner.playFirstVideo(document.getElementById("localDisplay"), true, PRELOADER_URL).then(function() {
|
|
128
|
-
publishLocalMedia(room);
|
|
129
|
-
onJoined(room);
|
|
130
|
-
});
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
publishLocalMedia(room);
|
|
121
|
+
publishLocalStream(room);
|
|
134
122
|
onJoined(room);
|
|
135
123
|
}).on(ROOM_EVENT.JOINED, function(participant){
|
|
136
124
|
installParticipant(participant);
|
|
@@ -164,7 +152,6 @@ function installParticipant(participant) {
|
|
|
164
152
|
} else {
|
|
165
153
|
var p = $("[id$=Name]:contains('NONE')")[0].id.replace('Name','');
|
|
166
154
|
var pName = '#' + p + 'Name';
|
|
167
|
-
var pDisplay = p + 'Display';
|
|
168
155
|
$(pName).text(participant.name());
|
|
169
156
|
playParticipantsStream(participant);
|
|
170
157
|
}
|
|
@@ -174,6 +161,8 @@ function removeParticipant(participant) {
|
|
|
174
161
|
$("[id$=Name]").each(function(index,value) {
|
|
175
162
|
if ($(value).text() == participant.name()) {
|
|
176
163
|
$(value).text('NONE');
|
|
164
|
+
var pButtonId = value.id.replace('Name', '') + 'Btn';
|
|
165
|
+
$("#" + pButtonId).text("Play").off('click').prop('disabled', true);
|
|
177
166
|
}
|
|
178
167
|
});
|
|
179
168
|
}
|
|
@@ -183,17 +172,68 @@ function playParticipantsStream(participant) {
|
|
|
183
172
|
$("[id$=Name]").each(function (index, value) {
|
|
184
173
|
if ($(value).text() == participant.name()) {
|
|
185
174
|
var p = value.id.replace('Name', '');
|
|
186
|
-
var pDisplay = p + 'Display';
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
175
|
+
var pDisplay = document.getElementById(p + 'Display');
|
|
176
|
+
if (Browser.isSafariWebRTC()) {
|
|
177
|
+
Flashphoner.playFirstVideo(pDisplay, false, PRELOADER_URL).then(function() {
|
|
178
|
+
playStream(participant, pDisplay);
|
|
179
|
+
}).catch(function (error) {
|
|
180
|
+
// Low Power Mode detected, user action is needed to start playback in this mode #WCS-2639
|
|
181
|
+
console.log("Can't atomatically play participant" + participant.name() + " stream, use Play button");
|
|
182
|
+
for (var i = 0; i < pDisplay.children.length; i++) {
|
|
183
|
+
if (pDisplay.children[i]) {
|
|
184
|
+
console.log("remove cached instance id " + pDisplay.children[i].id);
|
|
185
|
+
pDisplay.removeChild(pDisplay.children[i]);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
onParticipantStopped(participant);
|
|
190
189
|
});
|
|
191
|
-
}
|
|
190
|
+
} else {
|
|
191
|
+
playStream(participant, pDisplay);
|
|
192
|
+
}
|
|
192
193
|
}
|
|
193
194
|
});
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
|
|
198
|
+
function playStream(participant, display) {
|
|
199
|
+
var button = getParticipantButton(participant);
|
|
200
|
+
participant.getStreams()[0].play(display).on(STREAM_STATUS.PLAYING, function (playingStream) {
|
|
201
|
+
document.getElementById(playingStream.id()).addEventListener('resize', function (event) {
|
|
202
|
+
resizeVideo(event.target);
|
|
203
|
+
});
|
|
204
|
+
if (button) {
|
|
205
|
+
$(button).text("Stop").off('click').click(function(){
|
|
206
|
+
$(this).prop('disabled', true);
|
|
207
|
+
playingStream.stop();
|
|
208
|
+
}).prop('disabled', false);
|
|
209
|
+
}
|
|
210
|
+
}).on(STREAM_STATUS.STOPPED, function () {
|
|
211
|
+
onParticipantStopped(participant);
|
|
212
|
+
}).on(STREAM_STATUS.FAILED, function () {
|
|
213
|
+
onParticipantStopped(participant);
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function onParticipantStopped(participant) {
|
|
218
|
+
var button = getParticipantButton(participant);
|
|
219
|
+
if (button) {
|
|
220
|
+
$(button).text("Play").off('click').click(function() {
|
|
221
|
+
playParticipantsStream(participant);
|
|
222
|
+
}).prop('disabled', false);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function getParticipantButton(participant) {
|
|
227
|
+
var button = null;
|
|
228
|
+
$("[id$=Name]").each(function (index, value) {
|
|
229
|
+
if ($(value).text() == participant.name()) {
|
|
230
|
+
button = document.getElementById(value.id.replace('Name', '') + 'Btn');
|
|
231
|
+
return(button);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
return(button);
|
|
235
|
+
}
|
|
236
|
+
|
|
197
237
|
function getRoomName() {
|
|
198
238
|
var name = getUrlParam("roomName");
|
|
199
239
|
if (name && name !== '') {
|
|
@@ -239,7 +279,7 @@ function onMediaPublished(stream) {
|
|
|
239
279
|
function onMediaStopped(room) {
|
|
240
280
|
$("#localStopBtn").text("Publish").off('click').click(function(){
|
|
241
281
|
$(this).prop('disabled', true);
|
|
242
|
-
|
|
282
|
+
publishLocalStream(room);
|
|
243
283
|
}).prop('disabled', (connection.getRooms().length == 0));
|
|
244
284
|
$("#localAudioToggle").prop("disabled", true);
|
|
245
285
|
$("#localVideoToggle").prop("disabled", true);
|
|
@@ -274,6 +314,26 @@ function publishLocalMedia(room) {
|
|
|
274
314
|
});
|
|
275
315
|
}
|
|
276
316
|
|
|
317
|
+
function publishLocalStream(room) {
|
|
318
|
+
if (Browser.isSafariWebRTC()) {
|
|
319
|
+
var display = document.getElementById("localDisplay");
|
|
320
|
+
Flashphoner.playFirstVideo(display, true, PRELOADER_URL).then(function() {
|
|
321
|
+
publishLocalMedia(room);
|
|
322
|
+
}).catch(function (error) {
|
|
323
|
+
console.log("Can't atomatically publish local stream, use Publish button");
|
|
324
|
+
for (var i = 0; i < display.children.length; i++) {
|
|
325
|
+
if (display.children[i]) {
|
|
326
|
+
console.log("remove cached instance id " + display.children[i].id);
|
|
327
|
+
display.removeChild(display.children[i]);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
onMediaStopped(room);
|
|
331
|
+
});
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
publishLocalMedia(room);
|
|
335
|
+
}
|
|
336
|
+
|
|
277
337
|
function muteConnectInputs() {
|
|
278
338
|
$(':text').each(function(){
|
|
279
339
|
$(this).prop('disabled', true);
|