mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-04 17:51:03 +00:00
FS-11960: [js] replaces all deprecated js methods for FF warnings
This commit is contained in:
parent
1c80a83d57
commit
d5a065243f
html5/verto/js/src
@ -297,38 +297,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (self.localStream && !self.options.useStream) {
|
if (self.localStream && !self.options.useStream) {
|
||||||
if(typeof self.localStream.stop == 'function') {
|
var tracks = self.localStream.getTracks();
|
||||||
self.localStream.stop();
|
console.log("Stopping localStream tracks:", tracks);
|
||||||
} else {
|
tracks.forEach(function(track){ track.stop() })
|
||||||
if (self.localStream.active){
|
|
||||||
var tracks = self.localStream.getTracks();
|
|
||||||
console.log(tracks);
|
|
||||||
tracks.forEach(function(track, index){
|
|
||||||
console.log(track);
|
|
||||||
track.stop();
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.localStream = null;
|
self.localStream = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.options.localVideo) {
|
if (self.options.localVideo) {
|
||||||
deactivateLocalVideo(self.options.localVideo);
|
deactivateLocalVideo(self.options.localVideo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.options.localVideoStream && !self.options.useStream) {
|
if (self.options.localVideoStream && !self.options.useStream) {
|
||||||
if(typeof self.options.localVideoStream.stop == 'function') {
|
var tracks = self.options.localVideoStream.getTracks();
|
||||||
self.options.localVideoStream.stop();
|
console.log("Stopping localVideoStream tracks:", tracks);
|
||||||
} else {
|
tracks.forEach(function(track){ track.stop() })
|
||||||
if (self.options.localVideoStream.active){
|
|
||||||
var tracks = self.options.localVideoStream.getTracks();
|
|
||||||
console.log(tracks);
|
|
||||||
tracks.forEach(function(track, index){
|
|
||||||
console.log(track);
|
|
||||||
track.stop();
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.peer) {
|
if (self.peer) {
|
||||||
@ -785,18 +767,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
peer.onaddstream = function(event) {
|
// peer.onaddstream = function(event) { // OLD API
|
||||||
var remoteMediaStream = event.stream;
|
peer.ontrack = function(event) {
|
||||||
|
console.log('Peer Track', event)
|
||||||
|
// var remoteMediaStream = event.stream;
|
||||||
|
var remoteMediaStream = event.streams[0];
|
||||||
|
|
||||||
// onRemoteStreamEnded(MediaStream)
|
|
||||||
remoteMediaStream.oninactive = function () {
|
remoteMediaStream.oninactive = function () {
|
||||||
if (options.onRemoteStreamEnded) options.onRemoteStreamEnded(remoteMediaStream);
|
if (options.onRemoteStreamEnded) options.onRemoteStreamEnded(remoteMediaStream);
|
||||||
};
|
};
|
||||||
|
|
||||||
// onRemoteStream(MediaStream)
|
|
||||||
if (options.onRemoteStream) options.onRemoteStream(remoteMediaStream);
|
if (options.onRemoteStream) options.onRemoteStream(remoteMediaStream);
|
||||||
|
|
||||||
//console.debug('on:add:stream', remoteMediaStream);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//var constraints = options.constraints || {
|
//var constraints = options.constraints || {
|
||||||
@ -959,16 +940,13 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
stop: function() {
|
stop: function() {
|
||||||
peer.close();
|
if (options.attachStream instanceof MediaStream) {
|
||||||
if (options.attachStream) {
|
var tracks = options.attachStream.getTracks();
|
||||||
if(typeof options.attachStream.stop == 'function') {
|
tracks.forEach(function(track){ track.stop() })
|
||||||
options.attachStream.stop();
|
options.attachStream = null
|
||||||
} else {
|
|
||||||
options.attachStream.active = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
peer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1060,7 +1038,6 @@
|
|||||||
console.error('Unexpected error on media id assurance attempts:', error, 'Options:', options);
|
console.error('Unexpected error on media id assurance attempts:', error, 'Options:', options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$.FSRTC.resSupported = function(w, h) {
|
$.FSRTC.resSupported = function(w, h) {
|
||||||
for (var i in $.FSRTC.validRes) {
|
for (var i in $.FSRTC.validRes) {
|
||||||
if ($.FSRTC.validRes[i][0] == w && $.FSRTC.validRes[i][1] == h) {
|
if ($.FSRTC.validRes[i][0] == w && $.FSRTC.validRes[i][1] == h) {
|
||||||
@ -1115,14 +1092,12 @@
|
|||||||
video = assignMediaIdToConstraint(cam, video);
|
video = assignMediaIdToConstraint(cam, video);
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserMedia({
|
getUserMedia({
|
||||||
constraints: {
|
constraints: { audio: ttl++ == 0, video: video },
|
||||||
audio: ttl++ == 0,
|
|
||||||
video: video
|
|
||||||
},
|
|
||||||
onsuccess: function(e) {
|
onsuccess: function(e) {
|
||||||
e.getTracks().forEach(function(track) {track.stop();});
|
e.getTracks().forEach(function(track) { track.stop() });
|
||||||
console.info(w + "x" + h + " supported."); $.FSRTC.validRes.push([w, h]); checkRes(cam, func);},
|
console.info(w + "x" + h + " supported."); $.FSRTC.validRes.push([w, h]); checkRes(cam, func);
|
||||||
|
},
|
||||||
onerror: function(e) {console.warn( w + "x" + h + " not supported."); checkRes(cam, func);}
|
onerror: function(e) {console.warn( w + "x" + h + " not supported."); checkRes(cam, func);}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1152,33 +1127,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$.FSRTC.checkPerms = function (runtime, check_audio, check_video) {
|
$.FSRTC.checkPerms = function (runtime, check_audio, check_video) {
|
||||||
getUserMedia({
|
getUserMedia({
|
||||||
constraints: {
|
constraints: { audio: check_audio, video: check_video },
|
||||||
audio: check_audio,
|
onsuccess: function(e) {
|
||||||
video: check_video,
|
e.getTracks().forEach(function(track) { track.stop() });
|
||||||
},
|
console.info("media perm init complete");
|
||||||
onsuccess: function(e) {
|
if (runtime) {
|
||||||
|
|
||||||
e.getTracks().forEach(function(track) {track.stop();});
|
|
||||||
|
|
||||||
console.info("media perm init complete");
|
|
||||||
if (runtime) {
|
|
||||||
setTimeout(runtime, 100, true);
|
setTimeout(runtime, 100, true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onerror: function(e) {
|
onerror: function(e) {
|
||||||
if (check_video && check_audio) {
|
if (check_video && check_audio) {
|
||||||
console.error("error, retesting with audio params only");
|
console.error("error, retesting with audio params only");
|
||||||
return $.FSRTC.checkPerms(runtime, check_audio, false);
|
return $.FSRTC.checkPerms(runtime, check_audio, false);
|
||||||
}
|
}
|
||||||
|
console.error("media perm init error");
|
||||||
console.error("media perm init error");
|
if (runtime) {
|
||||||
|
runtime(false)
|
||||||
if (runtime) {
|
}
|
||||||
runtime(false)
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
@ -2837,16 +2837,15 @@
|
|||||||
has_video++;
|
has_video++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
navigator.mediaDevices.getUserMedia({ audio: (has_audio > 0 ? true : false), video: (has_video > 0 ? true : false)})
|
||||||
|
.then(function(stream) {
|
||||||
|
Xstream = stream;
|
||||||
|
navigator.mediaDevices.enumerateDevices().then(gotDevices).catch(handleError);
|
||||||
|
})
|
||||||
|
.catch(function(err) {
|
||||||
|
console.log("The following error occurred: " + err.name);
|
||||||
|
});
|
||||||
|
|
||||||
navigator.getUserMedia({ audio: (has_audio > 0 ? true : false), video: (has_video > 0 ? true : false)},
|
|
||||||
function(stream) {
|
|
||||||
Xstream = stream;
|
|
||||||
navigator.mediaDevices.enumerateDevices().then(gotDevices).catch(handleError);
|
|
||||||
},
|
|
||||||
function(err) {
|
|
||||||
console.log("The following error occurred: " + err.name);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
navigator.mediaDevices.enumerateDevices().then(checkTypes).catch(handleError);
|
navigator.mediaDevices.enumerateDevices().then(checkTypes).catch(handleError);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user