@flashphoner/websdk 2.0.247 → 2.0.249
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 +22 -0
- package/flashphoner-no-flash.js +30 -15
- package/flashphoner-no-flash.min.js +2 -2
- package/flashphoner-no-webrtc.js +9 -8
- package/flashphoner-no-webrtc.min.js +2 -2
- package/flashphoner-no-wsplayer.js +30 -15
- package/flashphoner-no-wsplayer.min.js +2 -2
- package/flashphoner-room-api.js +26 -11
- package/flashphoner-room-api.min.js +3 -3
- package/flashphoner-temasys-flash-websocket-without-adapterjs.js +9 -8
- package/flashphoner-temasys-flash-websocket.js +9 -8
- package/flashphoner-temasys-flash-websocket.min.js +1 -1
- package/flashphoner-webrtc-only.js +28 -13
- package/flashphoner-webrtc-only.min.js +1 -1
- package/flashphoner.js +30 -15
- package/flashphoner.min.js +2 -2
- package/package.json +1 -1
- package/src/flashphoner-core.js +2 -1
- package/src/media-source-media-provider.js +3 -3
- package/src/webrtc-media-provider.js +21 -7
|
@@ -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
|
}
|
|
@@ -615,12 +615,26 @@ var createConnection = function (options) {
|
|
|
615
615
|
if (localVideo && localVideo.srcObject && videoCams.length > 1 && !customStream && !screenShare) {
|
|
616
616
|
connection.getSenders().forEach(function (sender) {
|
|
617
617
|
if (sender.track.kind === 'audio') return;
|
|
618
|
-
switchCamCount = (switchCamCount + 1) % videoCams.length;
|
|
619
618
|
sender.track.stop();
|
|
620
|
-
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
|
+
}
|
|
621
635
|
//use the settings that were set during connection initiation
|
|
622
636
|
var clonedConstraints = Object.assign({}, constraints);
|
|
623
|
-
clonedConstraints.video.deviceId = {exact:
|
|
637
|
+
clonedConstraints.video.deviceId = {exact: cameraId};
|
|
624
638
|
clonedConstraints.audio = false;
|
|
625
639
|
navigator.mediaDevices.getUserMedia(clonedConstraints).then(function (newStream) {
|
|
626
640
|
var newVideoTrack = newStream.getVideoTracks()[0];
|
|
@@ -632,8 +646,8 @@ var createConnection = function (options) {
|
|
|
632
646
|
if (localVideo.srcObject.getAudioTracks().length == 0 && audioTrack) {
|
|
633
647
|
localVideo.srcObject.addTrack(audioTrack);
|
|
634
648
|
}
|
|
635
|
-
logger.info(LOG_PREFIX, "Switch camera to " +
|
|
636
|
-
resolve(
|
|
649
|
+
logger.info(LOG_PREFIX, "Switch camera to " + cameraId);
|
|
650
|
+
resolve(cameraId);
|
|
637
651
|
}).catch(function (reason) {
|
|
638
652
|
logger.error(LOG_PREFIX, reason);
|
|
639
653
|
reject(reason);
|