101 lines
3.5 KiB
CoffeeScript
101 lines
3.5 KiB
CoffeeScript
context = window
|
|
logger = context.JK.logger
|
|
MIX_MODES = context.JK.MIX_MODES
|
|
mixins = []
|
|
|
|
RecordingActions = @RecordingActions
|
|
|
|
mixins.push(Reflux.listenTo(@SessionMyTracksStore,"onInputChanged"))
|
|
mixins.push(Reflux.listenTo(RecordingStore,"onRecordingStateChanged"))
|
|
mixins.push(Reflux.listenTo(@AppStore,"onAppInit"))
|
|
|
|
@PopupSessionRecording = React.createClass({
|
|
mixins: mixins
|
|
|
|
onAppInit: (@app) ->
|
|
|
|
onInputChanged: (sessionMixers) ->
|
|
inputGroupMixers = {}
|
|
mixers = sessionMixers.mixers
|
|
if mixers
|
|
#categoryMixers = mixers.simulatedMusicCategoryMixers[MIX_MODES.MASTER]
|
|
categoryMixers = mixers.simulatedMusicCategoryMixers[MIX_MODES.PERSONAL]
|
|
if categoryMixers
|
|
inputGroupMixers = categoryMixers
|
|
|
|
@setState({inputGroupMixers: inputGroupMixers})
|
|
|
|
getInitialState: () ->
|
|
{ inputGroupMixers: {}, app: null }
|
|
|
|
onRecordingStateChanged: (recordingState) ->
|
|
if @unloaded
|
|
#console.log("PopupMediaControls unloaded. ignore onMixersChnaged")
|
|
return
|
|
this.setState(isRecording: recordingState.isRecording, recordedOnce: this.state.recordedOnce || recordingState.isRecording)
|
|
|
|
handleSettingSubmit: (settings) ->
|
|
volume = volume: @state.inputGroupMixers.mixer[0].volume_left
|
|
settings = $.extend({}, settings, volume)
|
|
try
|
|
localStorage.setItem("recordSettings", JSON.stringify(settings))
|
|
catch e
|
|
logger.info("error while saving recordSettings to localStorage")
|
|
logger.log(e.stack)
|
|
|
|
params = {
|
|
recordingType: settings.recordingType,
|
|
name: settings.recordingName,
|
|
audioFormat: settings.audioFormat,
|
|
includeChat: settings.includeChat,
|
|
volume: settings.volume,
|
|
}
|
|
|
|
if params.recordingType == context.JK.RECORD_TYPE_BOTH
|
|
params['videoFormat'] = settings.videoFormat
|
|
params['audioDelay'] = settings.audioDelay
|
|
|
|
#TODO: check OBS has been installed
|
|
obsReady = true
|
|
|
|
unless obsReady
|
|
context.JK.Banner.showAlert("To make a video recording in JamKazam, you must first install and configure OBS software. Click the link below for a help article that explains how to do this. <a href=''>View Help Article</a>")
|
|
return
|
|
|
|
unless context.JK.videoIsOngoing
|
|
context.JK.Banner.showAlert("To make a video recording in JamKazam you must have an ongoing video. You can start a video by clicking the Video button on session tool bar.")
|
|
return
|
|
|
|
console.log('_DEBUG_ starting recording', JSON.stringify(params))
|
|
@startStopRecording(params)
|
|
|
|
closeDialog: () ->
|
|
@app.layout.cancelDialog('session-recording')
|
|
|
|
startStopRecording: (params) ->
|
|
if @state.isRecording
|
|
RecordingActions.stopRecording()
|
|
else
|
|
#logger.debug("@inputType, @udiotye", recordChat, recordVideo)
|
|
#RecordingActions.startRecording(recordVideo, recordChat)
|
|
RecordingActions.startRecording(params)
|
|
|
|
render: () ->
|
|
if Object.keys(@state.inputGroupMixers).length > 0 then `<div className="recording-container">
|
|
<div className="recording-left">
|
|
<SessionRecordingSettings app={this.state.app} handleSubmit={this.handleSettingSubmit} handleCancel={this.closeDialog} />
|
|
</div>
|
|
<div className="recording-right">
|
|
<SessionRecordingVu mixers={this.state.inputGroupMixers} />
|
|
</div>
|
|
</div>` else `<span>Loading...</span>`
|
|
|
|
componentDidMount: () ->
|
|
$(window).unload(@windowUnloaded)
|
|
|
|
windowUnloaded: () ->
|
|
@unloaded = true
|
|
window.unloaded = true
|
|
|
|
RecordingActions.recordingControlsClosed()
|
|
}) |