context = window logger = context.JK.logger NoVideoRecordActive = 0 WebCamRecordActive = 1 ScreenRecordActive = 2 WebCam2RecordActive = 3 DesktopRecordActive = 4 mixins = [] # make sure this is actually us opening the window, not someone else (by checking for MixerStore) # this check ensures we attempt to listen if this component is created in a popup reactContext = if window.opener? then window.opener else window accessOpener = false if window.opener? try m = window.opener.MixerStore accessOpener = true catch e reactContext = window MixerStore = reactContext.MixerStore RecordingStore = reactContext.RecordingStore VideoStore = reactContext.VideoStore if accessOpener mixins.push(Reflux.listenTo(RecordingStore,"onRecordingStateChanged")) # mixins.push(Reflux.listenTo(MixerStore,"onMixersChanged")) @PopupRecordingStartStop = React.createClass({ mixins: mixins #onMixersChanged: (mixers) -> # this.setState(chatMixer: mixers.chatMixer) onRecordingStateChanged: (recordingState) -> if @unloaded #console.log("PopupMediaControls unloaded. ignore onMixersChnaged") return this.setState(isRecording: recordingState.isRecording, recordedOnce: this.state.recordedOnce || recordingState.isRecording) startStopRecording: () -> if this.state.isRecording window.opener.RecordingActions.stopRecording() else recordChat = false recordVideo = NoVideoRecordActive $root = $(this.getDOMNode()) if @inputType != 'audio-only' selection = $root.find('#recording-selection').val() if selection == 'video-window' recordVideo = ScreenRecordActive else if selection == 'webcam-only' recordVideo = WebCamRecordActive else if selection == 'webcam-only-2' recordVideo = WebCam2RecordActive else recordVideo = DesktopRecordActive recordChat = $root.find('#include-chat').is(':checked') # if the video window isn't open, but a video option was selected... window.opener.VideoActions.refreshVideoState.trigger() if recordVideo != NoVideoRecordActive && !VideoStore.anyVideoOpen #if recordVideo != NoVideoRecordActive && !VideoStore.videoShared logger.debug("prevent video from opening", VideoStore) context.JK.prodBubble($root.find('.control'), 'video-window-not-open', {}, {positions:['bottom']}) return if recordVideo == WebCamRecordActive && !VideoStore.openVideoSources.webcam1 context.JK.prodBubble($root.find('.control'), 'no-webcam-1', {}, {positions:['bottom']}) return if recordVideo == WebCam2RecordActive && !VideoStore.openVideoSources.webcam2 context.JK.prodBubble($root.find('.control'), 'no-webcam-2', {}, {positions:['bottom']}) return if recordVideo == DesktopRecordActive && !VideoStore.openVideoSources.screen_capture context.JK.prodBubble($root.find('.control'), 'no-screen-capture', {}, {positions:['bottom']}) return logger.debug("@inputType, @udiotye", recordChat, recordVideo) window.opener.RecordingActions.startRecording(recordVideo, recordChat) onNoteShowHide: () -> $root = $(this.getDOMNode()) audioVideoValue = $root.find('input[name="recording-input-type"]').val() console.log("audio video value", audioVideoValue) this.setState(showNote: !this.state.showNote) getInitialState: () -> {isRecording: window.ParentIsRecording, showNote: true, recordedOnce: false, chatMixer: MixerStore.mixers?.chatMixer} render: () -> recordingVerb = if this.state.isRecording then 'Stop' else 'Start' recordingBtnClasses = classNames({ "currently-recording" : this.state.isRecording, "control" : true }) noteJSX = `