mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-13 13:07:06 +00:00
Merge pull request #1553 in FS/freeswitch from ~THEHUNMONKGROUP/freeswitch:feature/FS-11287-provide-option-for-user-managed to master
* commit '96af587bf325ce35459cbd82e2e79bda0133a810': FS-11287: Provide option for user managed streams in Verto
This commit is contained in:
commit
1cf4981a82
2 files changed
+53
-23
No files matched your search
@@ -88,6 +88,7 @@
|
||||
onICE: function() {},
|
||||
onOfferSDP: function() {}
|
||||
},
|
||||
useStream: null,
|
||||
}, options);
|
||||
|
||||
this.audioEnabled = true;
|
||||
@@ -295,7 +296,7 @@
|
||||
self.options.useVideo['src'] = '';
|
||||
}
|
||||
|
||||
if (self.localStream) {
|
||||
if (self.localStream && !self.options.useStream) {
|
||||
if(typeof self.localStream.stop == 'function') {
|
||||
self.localStream.stop();
|
||||
} else {
|
||||
@@ -312,11 +313,10 @@
|
||||
}
|
||||
|
||||
if (self.options.localVideo) {
|
||||
self.options.localVideo.style.display = 'none';
|
||||
self.options.localVideo['src'] = '';
|
||||
deactivateLocalVideo(self.options.localVideo);
|
||||
}
|
||||
|
||||
if (self.options.localVideoStream) {
|
||||
if (self.options.localVideoStream && !self.options.useStream) {
|
||||
if(typeof self.options.localVideoStream.stop == 'function') {
|
||||
self.options.localVideoStream.stop();
|
||||
} else {
|
||||
@@ -449,7 +449,7 @@
|
||||
console.log("Audio constraints", mediaParams.audio);
|
||||
console.log("Video constraints", mediaParams.video);
|
||||
|
||||
if (self.options.useVideo && self.options.localVideo) {
|
||||
if (self.options.useVideo && self.options.localVideo && !self.options.useStream) {
|
||||
getUserMedia({
|
||||
constraints: {
|
||||
audio: false,
|
||||
@@ -461,17 +461,26 @@
|
||||
});
|
||||
}
|
||||
|
||||
getUserMedia({
|
||||
constraints: {
|
||||
audio: mediaParams.audio,
|
||||
video: mediaParams.video
|
||||
},
|
||||
video: mediaParams.useVideo,
|
||||
onsuccess: onSuccess,
|
||||
onerror: onError
|
||||
});
|
||||
|
||||
|
||||
if (self.options.useStream) {
|
||||
if (self.options.useVideo) {
|
||||
self.options.localVideoStream = self.options.useStream;
|
||||
if (self.options.localVideo) {
|
||||
activateLocalVideo(self.options.localVideo, self.options.useStream);
|
||||
}
|
||||
}
|
||||
onSuccess(self.options.useStream);
|
||||
}
|
||||
else {
|
||||
getUserMedia({
|
||||
constraints: {
|
||||
audio: mediaParams.audio,
|
||||
video: mediaParams.video
|
||||
},
|
||||
video: mediaParams.useVideo,
|
||||
onsuccess: onSuccess,
|
||||
onerror: onError
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -499,7 +508,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (obj.options.useVideo && obj.options.localVideo) {
|
||||
if (obj.options.useVideo && obj.options.localVideo && !obj.options.useStream) {
|
||||
getUserMedia({
|
||||
constraints: {
|
||||
audio: false,
|
||||
@@ -647,7 +656,16 @@
|
||||
console.log("Audio constraints", mediaParams.audio);
|
||||
console.log("Video constraints", mediaParams.video);
|
||||
|
||||
if (mediaParams.audio || mediaParams.video) {
|
||||
if (self.options.useStream) {
|
||||
if (self.options.useVideo) {
|
||||
self.options.localVideoStream = self.options.useStream;
|
||||
if (self.options.localVideo) {
|
||||
activateLocalVideo(self.options.localVideo, self.options.useStream);
|
||||
}
|
||||
}
|
||||
onSuccess(self.options.useStream);
|
||||
}
|
||||
else if (mediaParams.audio || mediaParams.video) {
|
||||
|
||||
getUserMedia({
|
||||
constraints: {
|
||||
@@ -953,6 +971,16 @@
|
||||
//optional: []
|
||||
};
|
||||
|
||||
function activateLocalVideo(el, stream) {
|
||||
el.srcObject = stream;
|
||||
el.style.display = 'block';
|
||||
}
|
||||
|
||||
function deactivateLocalVideo(el) {
|
||||
el.srcObject = null;
|
||||
el.style.display = 'none';
|
||||
}
|
||||
|
||||
function getUserMedia(options) {
|
||||
var n = navigator,
|
||||
media;
|
||||
@@ -968,8 +996,7 @@
|
||||
|
||||
function streaming(stream) {
|
||||
if (options.localVideo) {
|
||||
options.localVideo['srcObject'] = stream;
|
||||
options.localVideo.style.display = 'block';
|
||||
activateLocalVideo(options.localVideo, stream);
|
||||
}
|
||||
|
||||
if (options.onsuccess) {
|
||||
|
||||
Reference in new issue
Block a user