@flashphoner/websdk 2.0.246 → 2.0.248
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/media_devices_manager/manager.js +87 -53
- package/examples/demo/streaming/media_devices_manager/media_device_manager.html +14 -14
- package/examples/demo/streaming/screen-camera-mixer/screen-camera-mixer.html +4 -0
- package/examples/demo/streaming/screen-camera-mixer/screen-camera-mixer.js +70 -2
- package/flashphoner-no-flash.js +47 -19
- package/flashphoner-no-flash.min.js +2 -2
- package/flashphoner-no-webrtc.js +7 -7
- package/flashphoner-no-webrtc.min.js +2 -2
- package/flashphoner-no-wsplayer.js +47 -19
- package/flashphoner-no-wsplayer.min.js +2 -2
- package/flashphoner-room-api.js +45 -16
- package/flashphoner-room-api.min.js +3 -3
- package/flashphoner-temasys-flash-websocket-without-adapterjs.js +7 -7
- package/flashphoner-temasys-flash-websocket.js +7 -7
- package/flashphoner-temasys-flash-websocket.min.js +1 -1
- package/flashphoner-webrtc-only.js +45 -17
- package/flashphoner-webrtc-only.min.js +1 -1
- package/flashphoner.js +47 -19
- package/flashphoner.min.js +2 -2
- package/package.json +1 -1
- package/src/media-source-media-provider.js +3 -3
- package/src/webrtc-media-provider.js +42 -13
|
@@ -48,7 +48,7 @@ var createConnection = function (options) {
|
|
|
48
48
|
var localVideo;
|
|
49
49
|
//tweak for custom video players #WCS-1511
|
|
50
50
|
var remoteVideo = options.remoteVideo;
|
|
51
|
-
var
|
|
51
|
+
var switchCamIndex = 0;
|
|
52
52
|
var switchMicCount = 0;
|
|
53
53
|
var customStream = options.customStream;
|
|
54
54
|
var currentAudioTrack;
|
|
@@ -136,7 +136,7 @@ var createConnection = function (options) {
|
|
|
136
136
|
if (videoTrack) {
|
|
137
137
|
videoCams.forEach((cam, index) => {
|
|
138
138
|
if (videoTrack.label === cam.label) {
|
|
139
|
-
|
|
139
|
+
switchCamIndex = index;
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
142
|
}
|
|
@@ -463,18 +463,25 @@ var createConnection = function (options) {
|
|
|
463
463
|
stat.forEach(function (report) {
|
|
464
464
|
if (!report.isRemote) {
|
|
465
465
|
let mediaType = "";
|
|
466
|
-
if (report.type
|
|
466
|
+
if (report.type === 'outbound-rtp') {
|
|
467
467
|
mediaType = getReportMediaType(report);
|
|
468
468
|
fillStatObject(result.outboundStream, report, mediaType);
|
|
469
|
-
if (mediaType
|
|
469
|
+
if (mediaType === 'video') {
|
|
470
470
|
getVideoSize(result.outboundStream[mediaType], report);
|
|
471
471
|
}
|
|
472
|
-
} else if (report.type
|
|
472
|
+
} else if (report.type === 'inbound-rtp') {
|
|
473
473
|
mediaType = getReportMediaType(report);
|
|
474
474
|
fillStatObject(result.inboundStream, report, mediaType);
|
|
475
|
-
if (mediaType
|
|
475
|
+
if (mediaType === 'video') {
|
|
476
476
|
getVideoSize(result.inboundStream[mediaType], report);
|
|
477
477
|
}
|
|
478
|
+
} else if (report.type === 'candidate-pair' && report.state === 'succeeded' && report.nominated) {
|
|
479
|
+
if (report.availableIncomingBitrate) {
|
|
480
|
+
result.otherStats.availableIncomingBitrate = report.availableIncomingBitrate;
|
|
481
|
+
} else if (localVideo && report.availableOutgoingBitrate) {
|
|
482
|
+
// availableOutgoingBitrate is defined for incoming stream too #WCS-4175
|
|
483
|
+
result.otherStats.availableOutgoingBitrate = report.availableOutgoingBitrate;
|
|
484
|
+
}
|
|
478
485
|
}
|
|
479
486
|
}
|
|
480
487
|
});
|
|
@@ -532,19 +539,27 @@ var createConnection = function (options) {
|
|
|
532
539
|
} else {
|
|
533
540
|
logger.debug(LOG_PREFIX, "Can't parse current SDP to detect codec and sampleRate");
|
|
534
541
|
}
|
|
535
|
-
|
|
542
|
+
let codec = util.getCurrentCodecAndSampleRate(sdp, mediaType);
|
|
536
543
|
obj[mediaType]["codec"] = codec.name;
|
|
537
544
|
obj[mediaType]["codecRate"] = codec.sampleRate;
|
|
545
|
+
let qualityLimitationDurations;
|
|
538
546
|
Object.keys(report).forEach(function (key) {
|
|
539
547
|
// Add audioLevel parameter parsing #WCS-3290
|
|
540
548
|
if (key.startsWith("bytes") ||
|
|
541
549
|
key.startsWith("packets") ||
|
|
542
550
|
key.indexOf("Count") != -1 ||
|
|
543
551
|
key.indexOf("audioLevel") != -1 ||
|
|
544
|
-
key
|
|
552
|
+
key === "framesPerSecond" ||
|
|
553
|
+
key === "qualityLimitationReason" ) {
|
|
545
554
|
obj[mediaType][key] = report[key];
|
|
546
555
|
}
|
|
556
|
+
if (key === "qualityLimitationDurations") {
|
|
557
|
+
qualityLimitationDurations = report[key];
|
|
558
|
+
}
|
|
547
559
|
});
|
|
560
|
+
if (qualityLimitationDurations) {
|
|
561
|
+
obj[mediaType]["qualityLimitationDurations"] = qualityLimitationDurations[obj[mediaType]["qualityLimitationReason"]];
|
|
562
|
+
}
|
|
548
563
|
};
|
|
549
564
|
|
|
550
565
|
var fullScreen = function () {
|
|
@@ -600,12 +615,26 @@ var createConnection = function (options) {
|
|
|
600
615
|
if (localVideo && localVideo.srcObject && videoCams.length > 1 && !customStream && !screenShare) {
|
|
601
616
|
connection.getSenders().forEach(function (sender) {
|
|
602
617
|
if (sender.track.kind === 'audio') return;
|
|
603
|
-
switchCamCount = (switchCamCount + 1) % videoCams.length;
|
|
604
618
|
sender.track.stop();
|
|
605
|
-
var
|
|
619
|
+
var cameraId;
|
|
620
|
+
if (typeof deviceId !== "undefined") {
|
|
621
|
+
videoCams.forEach((cam, index) => {
|
|
622
|
+
if (deviceId === cam.id) {
|
|
623
|
+
switchCamIndex = index;
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
cameraId = deviceId;
|
|
627
|
+
} else {
|
|
628
|
+
switchCamIndex = (switchCamIndex + 1) % videoCams.length;
|
|
629
|
+
cameraId = videoCams[switchCamIndex].id;
|
|
630
|
+
}
|
|
631
|
+
if (!cameraId) {
|
|
632
|
+
logger.error(LOG_PREFIX, "Can't detect camera to switch to");
|
|
633
|
+
reject(constants.ERROR_INFO.CAN_NOT_SWITCH_CAM);
|
|
634
|
+
}
|
|
606
635
|
//use the settings that were set during connection initiation
|
|
607
636
|
var clonedConstraints = Object.assign({}, constraints);
|
|
608
|
-
clonedConstraints.video.deviceId = {exact:
|
|
637
|
+
clonedConstraints.video.deviceId = {exact: cameraId};
|
|
609
638
|
clonedConstraints.audio = false;
|
|
610
639
|
navigator.mediaDevices.getUserMedia(clonedConstraints).then(function (newStream) {
|
|
611
640
|
var newVideoTrack = newStream.getVideoTracks()[0];
|
|
@@ -617,8 +646,8 @@ var createConnection = function (options) {
|
|
|
617
646
|
if (localVideo.srcObject.getAudioTracks().length == 0 && audioTrack) {
|
|
618
647
|
localVideo.srcObject.addTrack(audioTrack);
|
|
619
648
|
}
|
|
620
|
-
logger.info(LOG_PREFIX, "Switch camera to " +
|
|
621
|
-
resolve(
|
|
649
|
+
logger.info(LOG_PREFIX, "Switch camera to " + cameraId);
|
|
650
|
+
resolve(cameraId);
|
|
622
651
|
}).catch(function (reason) {
|
|
623
652
|
logger.error(LOG_PREFIX, reason);
|
|
624
653
|
reject(reason);
|