ComunicWeb/assets/js/components/calls/userMedia.js

32 lines
479 B
JavaScript
Raw Normal View History

2019-01-24 13:40:36 +00:00
/**
* User media getter
*
* @author Pierre HUBERT
*/
ComunicWeb.components.calls.userMedia = {
/**
* Get user media
*
* @return {Promise} A promise to get user media
*/
get: function(){
//Use latest API
return navigator.mediaDevices
//Request user media
.getUserMedia({
audio: true,
video: true
})
//Save stream
.then(function(stream){
ComunicWeb.components.calls.userMedia._currMedia = stream;
return stream;
});
}
}