@flashphoner/websdk 2.0.256 → 2.0.258
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 +50 -3
- package/examples/demo/streaming/media_devices_manager/media_device_manager.html +14 -0
- package/examples/demo/streaming/screen-camera-mixer/screen-camera-mixer.html +50 -16
- package/examples/demo/streaming/screen-camera-mixer/screen-camera-mixer.js +47 -4
- package/flashphoner-no-flash.js +121 -14
- package/flashphoner-no-flash.min.js +2 -2
- package/flashphoner-no-webrtc.js +39 -1
- package/flashphoner-no-webrtc.min.js +1 -1
- package/flashphoner-no-wsplayer.js +121 -14
- package/flashphoner-no-wsplayer.min.js +2 -2
- package/flashphoner-room-api-webrtc-only.js +120 -13
- package/flashphoner-room-api-webrtc-only.min.js +1 -1
- package/flashphoner-room-api.js +117 -15
- package/flashphoner-room-api.min.js +2 -2
- package/flashphoner-temasys-flash-websocket-without-adapterjs.js +39 -1
- package/flashphoner-temasys-flash-websocket.js +39 -1
- package/flashphoner-temasys-flash-websocket.min.js +1 -1
- package/flashphoner-webrtc-only.js +120 -13
- package/flashphoner-webrtc-only.min.js +1 -1
- package/flashphoner.js +121 -14
- package/flashphoner.min.js +2 -2
- package/package.json +1 -1
- package/src/constants.d.ts +6 -0
- package/src/constants.js +6 -0
- package/src/flashphoner-core.d.ts +2 -0
- package/src/flashphoner-core.js +32 -0
- package/src/media-source-media-provider.js +1 -1
- package/src/webrtc-media-provider.js +78 -14
|
@@ -657,7 +657,6 @@ var createConnection = function (options) {
|
|
|
657
657
|
reject(constants.ERROR_INFO.CAN_NOT_SWITCH_CAM);
|
|
658
658
|
}
|
|
659
659
|
});
|
|
660
|
-
|
|
661
660
|
};
|
|
662
661
|
|
|
663
662
|
var switchMic = function (deviceId) {
|
|
@@ -818,16 +817,75 @@ var createConnection = function (options) {
|
|
|
818
817
|
};
|
|
819
818
|
|
|
820
819
|
var setPublishingBitrate = function(minBitrate, maxBitrate) {
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
820
|
+
updateVideoSettings({maxBitrate: maxBitrate});
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
var updateVideoSettings = function(settings) {
|
|
824
|
+
return new Promise(function (resolve, reject) {
|
|
825
|
+
if (connection && settings) {
|
|
826
|
+
connection.getSenders().forEach((sender) => {
|
|
827
|
+
if (sender.track.kind == "video") {
|
|
828
|
+
let parameters = sender.getParameters();
|
|
829
|
+
for (let i = 0; i < parameters.encodings.length; i++) {
|
|
830
|
+
if (settings.maxBitrate) {
|
|
831
|
+
parameters.encodings[i].maxBitrate = settings.maxBitrate * 1000;
|
|
832
|
+
} else if (parameters.encodings[i].maxBitrate) {
|
|
833
|
+
delete parameters.encodings[i].maxBitrate;
|
|
834
|
+
}
|
|
835
|
+
if (settings.frameRate) {
|
|
836
|
+
parameters.encodings[i].maxFramerate = settings.frameRate;
|
|
837
|
+
}
|
|
838
|
+
if (settings.scaleResolutionDownBy) {
|
|
839
|
+
parameters.encodings[i].scaleResolutionDownBy = settings.scaleResolutionDownBy;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
sender.setParameters(parameters).then(() => {
|
|
843
|
+
logger.info(LOG_PREFIX, "Set video encoder parameters to " + JSON.stringify(parameters.encodings));
|
|
844
|
+
resolve(parameters.encodings);
|
|
845
|
+
}).catch(function (reason) {
|
|
846
|
+
logger.error(LOG_PREFIX, reason);
|
|
847
|
+
reject(reason);
|
|
848
|
+
});
|
|
828
849
|
}
|
|
829
|
-
}
|
|
830
|
-
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
var updateVideoResolution = function (resolution) {
|
|
856
|
+
return new Promise(function (resolve, reject) {
|
|
857
|
+
if (connection && localVideo && localVideo.srcObject && !customStream && resolution) {
|
|
858
|
+
connection.getSenders().forEach(function (sender) {
|
|
859
|
+
if (sender.track.kind === 'audio') return;
|
|
860
|
+
sender.track.stop();
|
|
861
|
+
//use the settings that were set during connection initiation
|
|
862
|
+
var clonedConstraints = Object.assign({}, constraints);
|
|
863
|
+
if (resolution.width) {
|
|
864
|
+
clonedConstraints.video.width = {ideal: resolution.width};
|
|
865
|
+
}
|
|
866
|
+
if (resolution.height) {
|
|
867
|
+
clonedConstraints.video.height = {ideal: resolution.height};
|
|
868
|
+
}
|
|
869
|
+
clonedConstraints.audio = false;
|
|
870
|
+
navigator.mediaDevices.getUserMedia(clonedConstraints).then(function (newStream) {
|
|
871
|
+
var newVideoTrack = newStream.getVideoTracks()[0];
|
|
872
|
+
newVideoTrack.enabled = localVideo.srcObject.getVideoTracks()[0].enabled;
|
|
873
|
+
var audioTrack = localVideo.srcObject.getAudioTracks()[0];
|
|
874
|
+
sender.replaceTrack(newVideoTrack);
|
|
875
|
+
localVideo.srcObject = newStream;
|
|
876
|
+
// On Safari mobile _newStream_ doesn't contain audio track, so we need to add track from previous stream
|
|
877
|
+
if (localVideo.srcObject.getAudioTracks().length == 0 && audioTrack) {
|
|
878
|
+
localVideo.srcObject.addTrack(audioTrack);
|
|
879
|
+
}
|
|
880
|
+
logger.info(LOG_PREFIX, "Set video constraints to " + JSON.stringify(clonedConstraints.video));
|
|
881
|
+
resolve(clonedConstraints.video);
|
|
882
|
+
}).catch(function (reason) {
|
|
883
|
+
logger.error(LOG_PREFIX, reason);
|
|
884
|
+
reject(reason);
|
|
885
|
+
});
|
|
886
|
+
});
|
|
887
|
+
} else {
|
|
888
|
+
reject(constants.ERROR_INFO.CAN_NOT_SET_RESOLUTION);
|
|
831
889
|
}
|
|
832
890
|
});
|
|
833
891
|
};
|
|
@@ -865,6 +923,8 @@ var createConnection = function (options) {
|
|
|
865
923
|
exports.switchToScreen = switchToScreen;
|
|
866
924
|
exports.switchToCam = switchToCam;
|
|
867
925
|
exports.setPublishingBitrate = setPublishingBitrate;
|
|
926
|
+
exports.updateVideoSettings = updateVideoSettings;
|
|
927
|
+
exports.updateVideoResolution = updateVideoResolution;
|
|
868
928
|
connections[id] = exports;
|
|
869
929
|
resolve(exports);
|
|
870
930
|
});
|
|
@@ -1540,10 +1600,14 @@ function normalizeConstraints(constraints) {
|
|
|
1540
1600
|
|
|
1541
1601
|
//WCS-1972. fixed "TypeError"
|
|
1542
1602
|
// Set default FPS value
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1603
|
+
if (browserDetails.browser === "chrome" && browserDetails.version >= 134) {
|
|
1604
|
+
// Do not normalize framerate in Chrome 134 #WCS-4360
|
|
1605
|
+
} else {
|
|
1606
|
+
var frameRate = (!constraints.video.frameRate || constraints.video.frameRate == 0) ? 30 : constraints.video.frameRate;
|
|
1607
|
+
constraints.video.frameRate = {
|
|
1608
|
+
ideal: frameRate
|
|
1609
|
+
};
|
|
1610
|
+
}
|
|
1547
1611
|
}
|
|
1548
1612
|
}
|
|
1549
1613
|
|