@@ -2407,6 +2407,7 @@ function MediaStreamTrack(dataFromEvent) {
24072407 this . kind = dataFromEvent . kind ;
24082408 this . label = dataFromEvent . label ;
24092409 this . muted = false ; // TODO: No "muted" property in ObjC API.
2410+ this . capabilities = dataFromEvent . capabilities ;
24102411 this . readyState = dataFromEvent . readyState ;
24112412
24122413 // Private attributes.
@@ -2440,11 +2441,11 @@ Object.defineProperty(MediaStreamTrack.prototype, 'enabled', {
24402441} ) ;
24412442
24422443MediaStreamTrack . prototype . getConstraints = function ( ) {
2443- throw new Error ( 'Not implemented.' ) ;
2444+ return { } ;
24442445} ;
24452446
24462447MediaStreamTrack . prototype . applyConstraints = function ( ) {
2447- throw new Error ( 'Not implemented.' ) ;
2448+ return Promise . reject ( new Error ( 'applyConstraints is not implemented.' ) ) ;
24482449} ;
24492450
24502451MediaStreamTrack . prototype . clone = function ( ) {
@@ -2464,7 +2465,7 @@ MediaStreamTrack.prototype.clone = function () {
24642465MediaStreamTrack . prototype . getCapabilities = function ( ) {
24652466 //throw new Error('Not implemented.');
24662467 // SHAM
2467- return new MediaTrackCapabilities ( ) ;
2468+ return new MediaTrackCapabilities ( this . capabilities ) ;
24682469} ;
24692470
24702471MediaStreamTrack . prototype . getSettings = function ( ) {
@@ -4803,12 +4804,13 @@ module.exports = {
48034804 mediaStreams : mediaStreams ,
48044805 nativeCallback : exec . nativeCallback
48054806} ;
4807+
4808+ // register global variables right after webview loading
48064809registerGlobals ( ) ;
4807- initAudioDevices ( ) ;
4808- turnOnSpeaker ( true ) ;
4809- requestPermission ( true , true , function ( result ) {
4810- console . log ( 'requestPermission.result' , result ) ;
4811- } ) ;
4810+
4811+ MediaStreamTrack . prototype . clone = function ( ) {
4812+ return this ;
4813+ } ;
48124814
48134815domready ( function ( ) {
48144816 // Let the MediaStream class and the videoElementsHandler share same MediaStreams container.
@@ -4920,20 +4922,29 @@ function registerGlobals(doNotRestoreCallbacksSupport) {
49204922 global . navigator = { } ;
49214923 }
49224924
4923- if ( ! navigator . mediaDevices ) {
4924- navigator . mediaDevices = new MediaDevices ( ) ;
4925- }
4926-
49274925 // Restore Callback support
49284926 if ( ! doNotRestoreCallbacksSupport ) {
49294927 restoreCallbacksSupport ( ) ;
49304928 }
49314929
49324930 navigator . getUserMedia = getUserMedia ;
49334931 navigator . webkitGetUserMedia = getUserMedia ;
4934- navigator . mediaDevices . getUserMedia = getUserMedia ;
4935- navigator . mediaDevices . enumerateDevices = enumerateDevices ;
49364932
4933+ // Prevent WebRTC-adapter to overide navigator.mediaDevices after shim is applied since ios 14.3
4934+ Object . defineProperty (
4935+ navigator ,
4936+ 'mediaDevices' ,
4937+ {
4938+ value : new MediaDevices ( ) ,
4939+ writable : false
4940+ } ,
4941+ {
4942+ enumerable : false ,
4943+ configurable : false ,
4944+ writable : false ,
4945+ value : 'static'
4946+ } ) ;
4947+
49374948 window . RTCPeerConnection = RTCPeerConnection ;
49384949 window . webkitRTCPeerConnection = RTCPeerConnection ;
49394950 window . RTCSessionDescription = RTCSessionDescription ;
0 commit comments