diff --git a/html5/verto/js/src/jquery.FSRTC.js b/html5/verto/js/src/jquery.FSRTC.js
index e8e5463ca8..661442f0b4 100644
--- a/html5/verto/js/src/jquery.FSRTC.js
+++ b/html5/verto/js/src/jquery.FSRTC.js
@@ -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) {
diff --git a/html5/verto/js/src/jquery.verto.js b/html5/verto/js/src/jquery.verto.js
index 9b920151cd..6a4219fd56 100644
--- a/html5/verto/js/src/jquery.verto.js
+++ b/html5/verto/js/src/jquery.verto.js
@@ -80,7 +80,8 @@
userVariables: {},
iceServers: false,
ringSleep: 6000,
- sessid: null
+ sessid: null,
+ useStream: null
}, options);
if (verto.options.deviceParams.useCamera) {
@@ -1941,7 +1942,8 @@
tag: verto.options.tag,
localTag: verto.options.localTag,
login: verto.options.login,
- videoParams: verto.options.videoParams
+ videoParams: verto.options.videoParams,
+ useStream: verto.options.useStream,
}, params);
@@ -2099,7 +2101,8 @@
useCamera: dialog.useCamera,
useMic: dialog.useMic,
useSpeak: dialog.useSpeak,
- turnServer: verto.options.turnServer
+ turnServer: verto.options.turnServer,
+ useStream: dialog.params.useStream
});
dialog.rtc.verto = dialog.verto;