diff --git a/web/app/assets/javascripts/accounts.js b/web/app/assets/javascripts/accounts.js index c04a6b329..ac5d3fa18 100644 --- a/web/app/assets/javascripts/accounts.js +++ b/web/app/assets/javascripts/accounts.js @@ -47,7 +47,11 @@ if(gon.global.video_available && gon.global.video_available!="none" ) { var webcamName; - var webcam = context.jamClient.FTUECurrentSelectedVideoDevice() + var webcam = null; + if (context.jamClient.FTUECurrentSelectedVideoDevice) { + webcam = context.jamClient.FTUECurrentSelectedVideoDevice() + } + if (webcam == null || typeof(webcam) == "undefined" || Object.keys(webcam).length == 0) { webcamName = "None Configured" } else { diff --git a/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee b/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee index f20649cc7..9b0edd05f 100644 --- a/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee +++ b/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee @@ -9,6 +9,7 @@ JamTrackActions = @JamTrackActions SessionActions = @SessionActions RecordingActions = @RecordingActions NotificationActions = @NotificationActions +VideoActions = @VideoActions @SessionStore = Reflux.createStore( { @@ -52,11 +53,6 @@ NotificationActions = @NotificationActions RecordingActions.initModel(@recordingModel) @helper = new context.SessionHelper(@app, @currentSession, @participantsEverSeen, @isRecording, @downloadingJamTrack) - if gon.global.video_available && gon.global.video_available!="none" && context.JK.WebcamViewer? - @webcamViewer = new context.JK.WebcamViewer() - $sessionLayout = $("#create-session-layout") - @webcamViewer.init($sessionLayout, false) - @webcamViewer.setVideoOff() onVideoChanged: (@videoState) -> @@ -188,7 +184,7 @@ NotificationActions = @NotificationActions if @videoState?.videoEnabled logger.debug("toggle session video") - @webcamViewer.toggleWebcam() if @webcamViewer? + VideoActions.toggleVideo() else context.JK.Banner.showAlert({ title: "Video Is Disabled", @@ -570,8 +566,7 @@ NotificationActions = @NotificationActions shareDialog.initialize(context.JK.FacebookHelperInstance); # initialize webcamViewer - if gon.global.video_available && gon.global.video_available != "none" - @webcamViewer.beforeShow() + VideoActions.stopVideo(); # double-check that we are connected to the server via websocket @@ -985,8 +980,7 @@ NotificationActions = @NotificationActions logger.warn("no location specified in leaveSession action", behavior) window.location = '/client#/home' - if gon.global.video_available && gon.global.video_available != "none" - @webcamViewer.beforeHide() + VideoActions.stopVideo() @leaveSession() diff --git a/web/app/assets/javascripts/react-components/stores/VideoStore.js.coffee b/web/app/assets/javascripts/react-components/stores/VideoStore.js.coffee index 4bc9b18cf..3cca5720e 100644 --- a/web/app/assets/javascripts/react-components/stores/VideoStore.js.coffee +++ b/web/app/assets/javascripts/react-components/stores/VideoStore.js.coffee @@ -117,6 +117,8 @@ BackendToFrontendFPS = { @onRefresh() onStartVideo: -> + return unless context.jamClient.SessStartVideoSharing? + if @howtoWindow? @howtoWindow.close() @howtoWindow = null @@ -166,6 +168,9 @@ BackendToFrontendFPS = { onSelectDevice: (device, caps) -> + # don't do anything if no video capabilities + return unless context.jamClient.FTUESelectVideoCaptureDevice? + result = context.jamClient.FTUESelectVideoCaptureDevice(device, caps) if(!result) @logger.error("onSelectDevice failed with device #{device}") diff --git a/web/app/assets/javascripts/react-components/stores/WebcamViewer.js.jsx.coffee b/web/app/assets/javascripts/react-components/stores/WebcamViewer.js.jsx.coffee index ed02057cb..2ddf95e33 100644 --- a/web/app/assets/javascripts/react-components/stores/WebcamViewer.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/stores/WebcamViewer.js.jsx.coffee @@ -101,7 +101,6 @@ mixins.push(Reflux.listenTo(VideoStore, 'onVideoStateChanged')) # protect against non-video clients pointed at video-enabled server from getting into a session resolutions = @state.encodeResolutions frames = @state.frameRates - @logger.debug("Webcam state on render", @state) context._.each resolutions, (resolution, resolutionKey, obj) => #{1: "CIF (352X288)", 2: "VGA (640X480)", 3: "4CIF (704X576)", 4: "1/2WHD (640X360)", 5: "WHD (1280X720)", 6: "FHD (1920x1080)"} diff --git a/web/app/assets/javascripts/webcam_viewer.js.coffee b/web/app/assets/javascripts/webcam_viewer.js.coffee index 22cff4bb2..be395557f 100644 --- a/web/app/assets/javascripts/webcam_viewer.js.coffee +++ b/web/app/assets/javascripts/webcam_viewer.js.coffee @@ -70,6 +70,7 @@ context.JK.WebcamViewer = class WebcamViewer @videoSettingsHelp.click(false) beforeShow:() => + @videoShared = false # video can be assumed to be closed before htis is reached this.loadWebCams() this.selectWebcam() @@ -174,6 +175,7 @@ context.JK.WebcamViewer = class WebcamViewer @videoShared = false else @toggleBtn.addClass("selected") + alert("HERE?") @client.SessStartVideoSharing 0 @videoShared = true