From b79a7e185129620731e4f221a027c439d34a457a Mon Sep 17 00:00:00 2001
From: Anthony Minessale <anthm@freeswitch.org>
Date: Sat, 6 Dec 2014 11:40:44 -0600
Subject: [PATCH] vid screen share placeholder --args
 --enable-usermedia-screen-capturing --usermedia-screen-capturing

---
 html5/verto/js/src/jquery.FSRTC.js | 63 +++++++++++++++++++++++-------
 1 file changed, 49 insertions(+), 14 deletions(-)

diff --git a/html5/verto/js/src/jquery.FSRTC.js b/html5/verto/js/src/jquery.FSRTC.js
index a214c1f9db..8ca3602e04 100644
--- a/html5/verto/js/src/jquery.FSRTC.js
+++ b/html5/verto/js/src/jquery.FSRTC.js
@@ -191,8 +191,8 @@
         return true;
     }
 
-    function onStreamError(self) {
-        console.log('There has been a problem retrieving the streams - did you allow access?');
+    function onStreamError(self, e) {
+        console.log('There has been a problem retrieving the streams - did you allow access?', e);
 
     }
 
@@ -332,19 +332,36 @@
             onStreamSuccess(self);
         }
 
-        function onError() {
-            onStreamError(self);
+        function onError(e) {
+            onStreamError(self, e);
         }
 
+
+	var audio;
+
+	if (this.options.videoParams && this.options.videoParams.chromeMediaSource == 'screen') {
+
+	    this.options.videoParams = {
+		chromeMediaSource: 'screen',
+		maxWidth:screen.width,
+		maxHeight:screen.height
+	    };
+
+	    console.error("SCREEN SHARE");
+	    audio = false;
+	} else {
+	    audio = {
+		mandatory: this.options.audioParams,
+		optional: []
+	    };
+	}
+
 	console.log("Mandatory audio constraints", this.options.audioParams);
 	console.log("Mandatory video constraints", this.options.videoParams);
 
         getUserMedia({
             constraints: {
-                audio: {
-                    mandatory: this.options.audioParams,
-                    optional: []
-                },
+		audio: audio,
                 video: this.options.useVideo ? {
                     mandatory: this.options.videoParams,
                     optional: []
@@ -395,19 +412,37 @@
             onStreamSuccess(self);
         }
 
-        function onError() {
-            onStreamError(self);
+        function onError(e) {
+            onStreamError(self, e);
         }
 
+
+	var audio;
+
+	if (this.options.videoParams && this.options.videoParams.chromeMediaSource == 'screen') {
+
+	    this.options.videoParams = {
+		chromeMediaSource: 'screen',
+		maxWidth:screen.width,
+		maxHeight:screen.height
+	    };
+
+	    console.error("SCREEN SHARE");
+	    audio = false;
+	} else {
+	    audio = {
+		mandatory: this.options.audioParams,
+		optional: []
+	    };
+	}
+
 	console.log("Mandatory audio constraints", this.options.audioParams);
 	console.log("Mandatory video constraints", this.options.videoParams);
 
+
         getUserMedia({
             constraints: {
-                audio: {
-                    mandatory: this.options.audioParams,
-                    optional: []
-                },
+                audio: audio,
                 video: this.options.useVideo ? {
                     mandatory: this.options.videoParams,
                     optional: []