FS-7699
This commit is contained in:
parent
06f7040e21
commit
ac9506b084
|
@ -242,6 +242,6 @@ if(dialog.state.val>=$.verto.enum.state.early.val){dialog.setState($.verto.enum.
|
|||
if(params.display_number){dialog.params.remote_caller_id_number=params.display_number;}
|
||||
dialog.sendMessage($.verto.enum.message.display,{});};$.verto.dialog.prototype.handleMedia=function(params){var dialog=this;if(dialog.state.val>=$.verto.enum.state.early.val){return;}
|
||||
dialog.gotEarly=true;dialog.rtc.answer(params.sdp,function(){console.log("Dialog "+dialog.callID+"Establishing early media");dialog.setState($.verto.enum.state.early);if(dialog.gotAnswer){console.log("Dialog "+dialog.callID+"Answering Channel");dialog.setState($.verto.enum.state.active);}},function(e){console.error(e);dialog.hangup();});console.log("Dialog "+dialog.callID+"EARLY SDP",params.sdp);};$.verto.ENUM=function(s){var i=0,o={};s.split(" ").map(function(x){o[x]={name:x,val:i++};});return Object.freeze(o);};$.verto.enum={};$.verto.enum.states=Object.freeze({new:{requesting:1,recovering:1,ringing:1,destroy:1,answering:1,hangup:1},requesting:{trying:1,hangup:1},recovering:{answering:1,hangup:1},trying:{active:1,early:1,hangup:1},ringing:{answering:1,hangup:1},answering:{active:1,hangup:1},active:{answering:1,requesting:1,hangup:1,held:1},held:{hangup:1,active:1},early:{hangup:1,active:1},hangup:{destroy:1},destroy:{},purge:{destroy:1}});$.verto.enum.state=$.verto.ENUM("new requesting trying recovering ringing answering early active held hangup destroy purge");$.verto.enum.direction=$.verto.ENUM("inbound outbound");$.verto.enum.message=$.verto.ENUM("display info pvtEvent");$.verto.enum=Object.freeze($.verto.enum);$.verto.saved=[];$(window).bind('beforeunload',function(){for(var i in $.verto.saved){var verto=$.verto.saved[i];if(verto){verto.purge();verto.logout();}}
|
||||
return $.verto.warnOnUnload;});$.verto.videoDevices=[];$.verto.audioDevices=[];$.verto.init=function(obj,runtime){var aud=[],vid=[];$.FSRTC.getValidRes(obj.camera,function(){console.info("enumerating devices");if(MediaStreamTrack.getSources){MediaStreamTrack.getSources(function(media_sources){for(var i=0;i<media_sources.length;i++){if(media_sources[i].kind=='video'){vid.push(media_sources[i]);}else{aud.push(media_sources[i]);}}
|
||||
return $.verto.warnOnUnload;});$.verto.videoDevices=[];$.verto.audioDevices=[];var checkDevices=function(runtime){console.info("enumerating devices");var aud=[],vid=[];if(MediaStreamTrack.getSources){MediaStreamTrack.getSources(function(media_sources){for(var i=0;i<media_sources.length;i++){if(media_sources[i].kind=='video'){vid.push(media_sources[i]);}else{aud.push(media_sources[i]);}}
|
||||
$.verto.videoDevices=vid;$.verto.audioDevices=aud;console.info("Audio Devices",$.verto.audioDevices);console.info("Video Devices",$.verto.videoDevices);runtime();});}else{if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices){console.log("enumerateDevices() not supported.");return;}
|
||||
navigator.mediaDevices.enumerateDevices().then(function(devices){devices.forEach(function(device){console.log(device);console.log(device.kind+": "+device.label+" id = "+device.deviceId);if(device.kind==="videoinput"){vid.push({id:device.deviceId,kind:"video",label:device.label});}else{aud.push({id:device.deviceId,kind:"audio",label:device.label});}});$.verto.videoDevices=vid;$.verto.audioDevices=aud;console.info("Audio Devices",$.verto.audioDevices);console.info("Video Devices",$.verto.videoDevices);runtime();}).catch(function(err){console.log(err.name+": "+error.message);runtime();});}});}})(jQuery);
|
||||
navigator.mediaDevices.enumerateDevices().then(function(devices){devices.forEach(function(device){console.log(device);console.log(device.kind+": "+device.label+" id = "+device.deviceId);if(device.kind==="videoinput"){vid.push({id:device.deviceId,kind:"video",label:device.label});}else{aud.push({id:device.deviceId,kind:"audio",label:device.label});}});$.verto.videoDevices=vid;$.verto.audioDevices=aud;console.info("Audio Devices",$.verto.audioDevices);console.info("Video Devices",$.verto.videoDevices);runtime();}).catch(function(err){console.log(err.name+": "+error.message);runtime();}).else(runtime);}};$.verto.init=function(obj,runtime){checkDevices(function(){$.FSRTC.getValidRes(obj.camera,runtime);});}})(jQuery);
|
|
@ -2145,69 +2145,74 @@
|
|||
$.verto.videoDevices = [];
|
||||
$.verto.audioDevices = [];
|
||||
|
||||
$.verto.init = function(obj, runtime) {
|
||||
var aud = [], vid = [];
|
||||
|
||||
$.FSRTC.getValidRes(obj.camera, function() {
|
||||
console.info("enumerating devices");
|
||||
|
||||
if (MediaStreamTrack.getSources) {
|
||||
MediaStreamTrack.getSources(function (media_sources) {
|
||||
for (var i = 0; i < media_sources.length; i++) {
|
||||
var checkDevices = function(runtime) {
|
||||
console.info("enumerating devices");
|
||||
var aud = [], vid = [];
|
||||
|
||||
if (media_sources[i].kind == 'video') {
|
||||
vid.push(media_sources[i]);
|
||||
} else {
|
||||
aud.push(media_sources[i]);
|
||||
}
|
||||
if (MediaStreamTrack.getSources) {
|
||||
MediaStreamTrack.getSources(function (media_sources) {
|
||||
for (var i = 0; i < media_sources.length; i++) {
|
||||
|
||||
if (media_sources[i].kind == 'video') {
|
||||
vid.push(media_sources[i]);
|
||||
} else {
|
||||
aud.push(media_sources[i]);
|
||||
}
|
||||
}
|
||||
|
||||
$.verto.videoDevices = vid;
|
||||
$.verto.audioDevices = aud;
|
||||
|
||||
console.info("Audio Devices", $.verto.audioDevices);
|
||||
console.info("Video Devices", $.verto.videoDevices);
|
||||
runtime();
|
||||
});
|
||||
} else {
|
||||
/* of course it's a totally different API CALL with different element names for the same exact thing */
|
||||
|
||||
if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) {
|
||||
console.log("enumerateDevices() not supported.");
|
||||
return;
|
||||
}
|
||||
|
||||
// List cameras and microphones.
|
||||
|
||||
navigator.mediaDevices.enumerateDevices()
|
||||
.then(function(devices) {
|
||||
devices.forEach(function(device) {
|
||||
console.log(device);
|
||||
|
||||
console.log(device.kind + ": " + device.label +
|
||||
" id = " + device.deviceId);
|
||||
|
||||
if (device.kind === "videoinput") {
|
||||
vid.push({id: device.deviceId, kind: "video", label: device.label});
|
||||
} else {
|
||||
aud.push({id: device.deviceId, kind: "audio", label: device.label});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$.verto.videoDevices = vid;
|
||||
$.verto.audioDevices = aud;
|
||||
|
||||
console.info("Audio Devices", $.verto.audioDevices);
|
||||
console.info("Video Devices", $.verto.videoDevices);
|
||||
runtime();
|
||||
});
|
||||
} else {
|
||||
/* of course it's a totally different API CALL with different element names for the same exact thing */
|
||||
|
||||
if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) {
|
||||
console.log("enumerateDevices() not supported.");
|
||||
return;
|
||||
}
|
||||
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.log(err.name + ": " + error.message);
|
||||
runtime();
|
||||
}).else(runtime);
|
||||
}
|
||||
|
||||
// List cameras and microphones.
|
||||
};
|
||||
|
||||
navigator.mediaDevices.enumerateDevices()
|
||||
.then(function(devices) {
|
||||
devices.forEach(function(device) {
|
||||
console.log(device);
|
||||
|
||||
console.log(device.kind + ": " + device.label +
|
||||
" id = " + device.deviceId);
|
||||
|
||||
if (device.kind === "videoinput") {
|
||||
vid.push({id: device.deviceId, kind: "video", label: device.label});
|
||||
} else {
|
||||
aud.push({id: device.deviceId, kind: "audio", label: device.label});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$.verto.videoDevices = vid;
|
||||
$.verto.audioDevices = aud;
|
||||
|
||||
console.info("Audio Devices", $.verto.audioDevices);
|
||||
console.info("Video Devices", $.verto.videoDevices);
|
||||
runtime();
|
||||
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.log(err.name + ": " + error.message);
|
||||
runtime();
|
||||
});
|
||||
}
|
||||
$.verto.init = function(obj, runtime) {
|
||||
checkDevices(function() {
|
||||
$.FSRTC.getValidRes(obj.camera, runtime);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -242,6 +242,6 @@ if(dialog.state.val>=$.verto.enum.state.early.val){dialog.setState($.verto.enum.
|
|||
if(params.display_number){dialog.params.remote_caller_id_number=params.display_number;}
|
||||
dialog.sendMessage($.verto.enum.message.display,{});};$.verto.dialog.prototype.handleMedia=function(params){var dialog=this;if(dialog.state.val>=$.verto.enum.state.early.val){return;}
|
||||
dialog.gotEarly=true;dialog.rtc.answer(params.sdp,function(){console.log("Dialog "+dialog.callID+"Establishing early media");dialog.setState($.verto.enum.state.early);if(dialog.gotAnswer){console.log("Dialog "+dialog.callID+"Answering Channel");dialog.setState($.verto.enum.state.active);}},function(e){console.error(e);dialog.hangup();});console.log("Dialog "+dialog.callID+"EARLY SDP",params.sdp);};$.verto.ENUM=function(s){var i=0,o={};s.split(" ").map(function(x){o[x]={name:x,val:i++};});return Object.freeze(o);};$.verto.enum={};$.verto.enum.states=Object.freeze({new:{requesting:1,recovering:1,ringing:1,destroy:1,answering:1,hangup:1},requesting:{trying:1,hangup:1},recovering:{answering:1,hangup:1},trying:{active:1,early:1,hangup:1},ringing:{answering:1,hangup:1},answering:{active:1,hangup:1},active:{answering:1,requesting:1,hangup:1,held:1},held:{hangup:1,active:1},early:{hangup:1,active:1},hangup:{destroy:1},destroy:{},purge:{destroy:1}});$.verto.enum.state=$.verto.ENUM("new requesting trying recovering ringing answering early active held hangup destroy purge");$.verto.enum.direction=$.verto.ENUM("inbound outbound");$.verto.enum.message=$.verto.ENUM("display info pvtEvent");$.verto.enum=Object.freeze($.verto.enum);$.verto.saved=[];$(window).bind('beforeunload',function(){for(var i in $.verto.saved){var verto=$.verto.saved[i];if(verto){verto.purge();verto.logout();}}
|
||||
return $.verto.warnOnUnload;});$.verto.videoDevices=[];$.verto.audioDevices=[];$.verto.init=function(obj,runtime){var aud=[],vid=[];$.FSRTC.getValidRes(obj.camera,function(){console.info("enumerating devices");if(MediaStreamTrack.getSources){MediaStreamTrack.getSources(function(media_sources){for(var i=0;i<media_sources.length;i++){if(media_sources[i].kind=='video'){vid.push(media_sources[i]);}else{aud.push(media_sources[i]);}}
|
||||
return $.verto.warnOnUnload;});$.verto.videoDevices=[];$.verto.audioDevices=[];var checkDevices=function(runtime){console.info("enumerating devices");var aud=[],vid=[];if(MediaStreamTrack.getSources){MediaStreamTrack.getSources(function(media_sources){for(var i=0;i<media_sources.length;i++){if(media_sources[i].kind=='video'){vid.push(media_sources[i]);}else{aud.push(media_sources[i]);}}
|
||||
$.verto.videoDevices=vid;$.verto.audioDevices=aud;console.info("Audio Devices",$.verto.audioDevices);console.info("Video Devices",$.verto.videoDevices);runtime();});}else{if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices){console.log("enumerateDevices() not supported.");return;}
|
||||
navigator.mediaDevices.enumerateDevices().then(function(devices){devices.forEach(function(device){console.log(device);console.log(device.kind+": "+device.label+" id = "+device.deviceId);if(device.kind==="videoinput"){vid.push({id:device.deviceId,kind:"video",label:device.label});}else{aud.push({id:device.deviceId,kind:"audio",label:device.label});}});$.verto.videoDevices=vid;$.verto.audioDevices=aud;console.info("Audio Devices",$.verto.audioDevices);console.info("Video Devices",$.verto.videoDevices);runtime();}).catch(function(err){console.log(err.name+": "+error.message);runtime();});}});}})(jQuery);
|
||||
navigator.mediaDevices.enumerateDevices().then(function(devices){devices.forEach(function(device){console.log(device);console.log(device.kind+": "+device.label+" id = "+device.deviceId);if(device.kind==="videoinput"){vid.push({id:device.deviceId,kind:"video",label:device.label});}else{aud.push({id:device.deviceId,kind:"audio",label:device.label});}});$.verto.videoDevices=vid;$.verto.audioDevices=aud;console.info("Audio Devices",$.verto.audioDevices);console.info("Video Devices",$.verto.videoDevices);runtime();}).catch(function(err){console.log(err.name+": "+error.message);runtime();}).else(runtime);}};$.verto.init=function(obj,runtime){checkDevices(function(){$.FSRTC.getValidRes(obj.camera,runtime);});}})(jQuery);
|
|
@ -1240,7 +1240,7 @@ function init() {
|
|||
refresh_devices();
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$(window).load(function() {
|
||||
var hash = window.location.hash.substring(1);
|
||||
var a = [];
|
||||
|
||||
|
|
Loading…
Reference in New Issue