* fix how player occurs in native client
This commit is contained in:
parent
023648a5be
commit
f086ff74c3
|
|
@ -195,8 +195,58 @@ rest = context.JK.Rest()
|
|||
onPlayJamTrack: (jamTrack, e) ->
|
||||
e.preventDefault()
|
||||
|
||||
# popup window
|
||||
JamTrackPlayerActions.open(jamTrack)
|
||||
if context.jamClient.IsNativeClient()
|
||||
tracks = context.JK.TrackHelpers.getUserTracks(context.jamClient)
|
||||
data = {}
|
||||
data.client_id = @app.clientId
|
||||
#data.description = $('#description').val()
|
||||
data.description = "Jam Track Session"
|
||||
data.as_musician = true
|
||||
data.legal_terms = true
|
||||
data.intellectual_property = true
|
||||
data.approval_required = false
|
||||
data.musician_access = false
|
||||
data.fan_access = false
|
||||
data.fan_chat = false
|
||||
console.log("jamTrack", jamTrack)
|
||||
data.genre = $.map(jamTrack.genres, (genre) -> genre.id)
|
||||
data.genres = $.map(jamTrack.genres, (genre)-> genre.id)
|
||||
|
||||
data.genre = ['rock'] if data.genre.length == 0
|
||||
data.genres = ['rock'] if data.genres.length == 0
|
||||
# data.genres = context.JK.GenreSelectorHelper.getSelectedGenres('#create-session-genre')
|
||||
# data.musician_access = if $('#musician-access option:selected').val() == 'true' then true else false
|
||||
# data.approval_required = if $('input[name=\'musician-access-option\']:checked').val() == 'true' then true else false
|
||||
# data.fan_access = if $('#fan-access option:selected').val() == 'true' then true else false
|
||||
# data.fan_chat = if $('input[name=\'fan-chat-option\']:checked').val() == 'true' then true else false
|
||||
# if $('#band-list option:selected').val() != ''
|
||||
# data.band = $('#band-list option:selected').val()
|
||||
data.audio_latency = context.jamClient.FTUEGetExpectedLatency().latency
|
||||
data.tracks = tracks
|
||||
|
||||
rest.legacyCreateSession(data).done((response) =>
|
||||
newSessionId = response.id
|
||||
context.JK.SessionUtils.setAutoOpenJamTrack(jamTrack) # so that the session screen will pick this up
|
||||
context.location = '/client#/session/' + newSessionId
|
||||
# Re-loading the session settings will cause the form to reset with the right stuff in it.
|
||||
# This is an extra xhr call, but it keeps things to a single codepath
|
||||
#loadSessionSettings()
|
||||
context.JK.GA.trackSessionCount data.musician_access, data.fan_access, 0
|
||||
context.JK.GA.trackSessionMusicians context.JK.GA.SessionCreationTypes.create
|
||||
).fail (jqXHR) =>
|
||||
handled = false
|
||||
if jqXHR.status = 422
|
||||
response = JSON.parse(jqXHR.responseText)
|
||||
if response['errors'] and response['errors']['tracks'] and response['errors']['tracks'][0] == 'Please select at least one track'
|
||||
@app.notifyAlert 'No Inputs Configured', $('<span>You will need to reconfigure your audio device.</span>')
|
||||
handled = true
|
||||
if !handled
|
||||
@app.notifyServerError jqXHR, 'Unable to Create Session'
|
||||
|
||||
else
|
||||
# popup window
|
||||
JamTrackPlayerActions.open(jamTrack)
|
||||
|
||||
|
||||
|
||||
onAppInit: (@app) ->
|
||||
|
|
|
|||
|
|
@ -169,6 +169,7 @@ mixins.push(Reflux.listenTo(JamTrackStore, 'onJamTrackChanged'))
|
|||
myMixdowns = []
|
||||
|
||||
boundPlayClick = this.jamTrackPlay.bind(this, jamTrack);
|
||||
boundDownloadClick = this.jamTrackDownload.bind(this, jamTrack);
|
||||
|
||||
active = jamTrack.last_mixdown_id == null
|
||||
|
||||
|
|
@ -179,6 +180,9 @@ mixins.push(Reflux.listenTo(JamTrackStore, 'onJamTrackChanged'))
|
|||
</div>
|
||||
<div className="mixdown-actions">
|
||||
<img src="/assets/content/icon_open@2X.png" className="mixdown-play" onClick={boundPlayClick}/>
|
||||
<img src="/assets/content/icon_download@2X.png" className="mixdown-download" onClick={boundDownloadClick}/>
|
||||
<img src ="/assets/content/icon-delete@2X.png" style={{visibility:'hidden'}} className="mixdown-edit" onClick={false} />
|
||||
<img src ="/assets/content/icon-delete@2X.png" style={{visibility:'hidden'}} className="mixdown-delete" onClick={false} />
|
||||
</div>
|
||||
</div>`
|
||||
|
||||
|
|
@ -189,6 +193,7 @@ mixins.push(Reflux.listenTo(JamTrackStore, 'onJamTrackChanged'))
|
|||
boundDeleteClick = this.mixdownDelete.bind(this, mixdown);
|
||||
boundErrorClick = this.mixdownError.bind(this, mixdown);
|
||||
boundEditKeydown = this.onEditKeydown.bind(this, mixdown);
|
||||
boundDownloadReadyClick = this.downloadMixdownReady.bind(this, mixdown)
|
||||
|
||||
mixdown_package = mixdown.myPackage
|
||||
|
||||
|
|
@ -225,6 +230,8 @@ mixins.push(Reflux.listenTo(JamTrackStore, 'onJamTrackChanged'))
|
|||
mixdownName = mixdown.name
|
||||
editIcon = `<img src="/assets/content/icon-edit@2X.png" className="mixdown-edit" onClick={boundEditClick}/>`
|
||||
|
||||
download = `<img src="/assets/content/icon_download@2X.png" className="mixdown-download" onClick={boundDownloadReadyClick} />`
|
||||
|
||||
myMixdowns.push `
|
||||
<div key={mixdown.id} className={classNames({'mixdown-display': true, 'active' : active})}>
|
||||
<div className="mixdown-name">
|
||||
|
|
@ -232,7 +239,7 @@ mixins.push(Reflux.listenTo(JamTrackStore, 'onJamTrackChanged'))
|
|||
</div>
|
||||
<div className="mixdown-actions">
|
||||
{action}
|
||||
|
||||
{download}
|
||||
{editIcon}
|
||||
|
||||
<img src ="/assets/content/icon-delete@2X.png" className="mixdown-delete" onClick={boundDeleteClick} />
|
||||
|
|
@ -446,6 +453,11 @@ mixins.push(Reflux.listenTo(JamTrackStore, 'onJamTrackChanged'))
|
|||
|
||||
JamTrackActions.activateNoMixdown(jamtrack)
|
||||
|
||||
jamTrackDownload: (jamTrack, e) ->
|
||||
e.preventDefault()
|
||||
|
||||
AppActions.openExternalUrl(window.location.protocol + '//' + window.location.host + "/api/jamtracks/#{jamTrack.id}/stems/master/download.mp3?file_type=mp3&download=1")
|
||||
|
||||
onEditKeydown: (mixdown, e) ->
|
||||
logger.debug("on edit keydown", e)
|
||||
if e.keyCode == 13 # enter
|
||||
|
|
@ -472,6 +484,13 @@ mixins.push(Reflux.listenTo(JamTrackStore, 'onJamTrackChanged'))
|
|||
if confirm("Delete this custom mix?")
|
||||
JamTrackMixdownActions.deleteMixdown(mixdown)
|
||||
|
||||
downloadMixdownReady: (mixdown, e) ->
|
||||
e.preventDefault()
|
||||
|
||||
if mixdown.myPackage?.signing_state == 'SIGNED'
|
||||
AppActions.openExternalUrl(window.location.protocol + '//' + window.location.host + "/api/mixdowns/#{mixdown.id}/download.mp3?file_type=mp3&sample_rate=48&download=1")
|
||||
else
|
||||
alert("The mix is not yet ready to download")
|
||||
|
||||
mixdownError: (mixdown) ->
|
||||
|
||||
|
|
|
|||
|
|
@ -166,9 +166,23 @@ body.media-controls-popup.popup {
|
|||
cursor:pointer;
|
||||
}
|
||||
|
||||
|
||||
.mixdown-download {
|
||||
width:24px;
|
||||
height:24px;
|
||||
display:none;
|
||||
|
||||
cursor:pointer;
|
||||
|
||||
&.not-ready {
|
||||
visibility:hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.mixdown-play {
|
||||
width:24px;
|
||||
height:24px;
|
||||
//margin-right:10px;
|
||||
|
||||
cursor:pointer;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue