* VRFS-3356, VRFS-3371 - deal with async timing issues for self and remote peers as you join a session
This commit is contained in:
parent
b777fb5364
commit
0f85888479
|
|
@ -1,4 +1,5 @@
|
|||
context = window
|
||||
MixerActions = context.MixerActions
|
||||
ReactCSSTransitionGroup = React.addons.CSSTransitionGroup
|
||||
|
||||
@SessionOtherTracks = React.createClass({
|
||||
|
|
@ -50,6 +51,8 @@ ReactCSSTransitionGroup = React.addons.CSSTransitionGroup
|
|||
noAudio: noAudioUsers[participant.client_id]
|
||||
}
|
||||
|
||||
MixerActions.missingPeerMixer(participant.client_id) unless hasMixer
|
||||
|
||||
participants.push(participantState)
|
||||
|
||||
this.setState(participants: participants, session: session)
|
||||
|
|
|
|||
|
|
@ -13,4 +13,5 @@ context = window
|
|||
openMetronome: {}
|
||||
metronomeChanged: {}
|
||||
deadUserRemove: {}
|
||||
missingPeerMixer: {}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -535,7 +535,7 @@ MIX_MODES = context.JK.MIX_MODES;
|
|||
|
||||
for mixer in mixers
|
||||
unless mixer?
|
||||
logger.debug("empty mixer: ", mixers)
|
||||
#logger.debug("empty mixer: ", mixers)
|
||||
continue
|
||||
|
||||
if mixer.client_id == clientId
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ rest = context.JK.Rest()
|
|||
|
||||
metro: {tempo: 120, cricket: false, sound: "Beep" }
|
||||
noAudioUsers : {}
|
||||
checkingMissingPeers : {}
|
||||
missingMixerPeers : {}
|
||||
recheckTimeout : null
|
||||
|
||||
init: ->
|
||||
# Register with the app store to get @app
|
||||
|
|
@ -34,6 +37,7 @@ rest = context.JK.Rest()
|
|||
this.listenTo(context.MixerActions.openMetronome, this.onOpenMetronome)
|
||||
this.listenTo(context.MixerActions.metronomeChanged, this.onMetronomeChanged)
|
||||
this.listenTo(context.MixerActions.deadUserRemove, this.onDeadUserRemove)
|
||||
this.listenTo(context.MixerActions.missingPeerMixer, this.onMissingPeerMixer)
|
||||
|
||||
context.JK.HandleVolumeChangeCallback2 = @handleVolumeChangeCallback
|
||||
context.JK.HandleMetronomeCallback2 = @handleMetronomeCallback
|
||||
|
|
@ -114,7 +118,10 @@ rest = context.JK.Rest()
|
|||
|
||||
|
||||
sessionEnded: () ->
|
||||
@checkingMissingPeers = {}
|
||||
@noAudioUsers = {}
|
||||
@missingMixerPeers = {}
|
||||
clearTimeout(@recheckTimeout) if @recheckTimeout?
|
||||
|
||||
onSessionChange: (session) ->
|
||||
|
||||
|
|
@ -186,6 +193,35 @@ rest = context.JK.Rest()
|
|||
|
||||
@issueChange()
|
||||
|
||||
onMissingPeerMixer: (clientId) ->
|
||||
|
||||
missingPeerAttempts = @missingMixerPeers[clientId]
|
||||
|
||||
# check for 5 tries (10 seconds if setTimeout is 2000ms)
|
||||
if !missingPeerAttempts? || missingPeerAttempts < 5
|
||||
@checkingMissingPeers[clientId] = true
|
||||
@recheckTimeout = setTimeout(@recheckForMixers, 2000) unless @recheckTimeout?
|
||||
else
|
||||
logger.debug("ignoring missing peer recheck. missingPeerAttempts: #{missingPeerAttempts}")
|
||||
|
||||
recheckForMixers: () ->
|
||||
# increment how many times we've checked for this particular peer
|
||||
for clientId, meh of @checkingMissingPeers
|
||||
missingPeerAttempts = @missingMixerPeers[clientId]
|
||||
missingPeerAttempts = 0 unless missingPeerAttempts?
|
||||
missingPeerAttempts++
|
||||
@missingMixerPeers[clientId] = missingPeerAttempts
|
||||
|
||||
# reset the peers we are looking for
|
||||
@checkingMissingPeers = {}
|
||||
|
||||
@recheckTimeout = null
|
||||
@masterMixers = context.jamClient.SessionGetAllControlState(true);
|
||||
@personalMixers = context.jamClient.SessionGetAllControlState(false);
|
||||
logger.debug("MixerStore: recheckForMixers")
|
||||
@mixers = new context.MixerHelper(@session, @masterMixers, @personalMixers, @metro, @noAudioUsers, @mixers?.mixMode || MIX_MODES.PERSONAL)
|
||||
@issueChange()
|
||||
|
||||
onInitGain: (mixer) ->
|
||||
@mixers.initGain(mixer)
|
||||
|
||||
|
|
@ -212,9 +248,7 @@ rest = context.JK.Rest()
|
|||
|
||||
onSyncTracks: () ->
|
||||
logger.debug("MixerStore: onSyncTracks")
|
||||
# XXX using SessionStore directly, because SessionHelper.inSession() is based on if the session has been requested, not if the user has attempted to join the session
|
||||
#unless @session.inSession()
|
||||
unless context.SessionStore.inSession()
|
||||
unless @session.inSession()
|
||||
logger.debug("dropping sync tracks because no longer in session")
|
||||
return
|
||||
|
||||
|
|
@ -230,7 +264,7 @@ rest = context.JK.Rest()
|
|||
syncTrackRequest.tracks = inputTracks
|
||||
syncTrackRequest.backing_tracks = backingTracks
|
||||
syncTrackRequest.metronome_open = metronomeTracks.length > 0
|
||||
syncTrackRequest.id = context.SessionStore.currentSessionId
|
||||
syncTrackRequest.id = @session.id()
|
||||
|
||||
rest.putTrackSyncChange(syncTrackRequest)
|
||||
.fail((jqXHR)=>
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ NotificationActions = @NotificationActions
|
|||
logger.debug("backing tracks changed", previousBackingTracks, backingTracks)
|
||||
MixerActions.syncTracks()
|
||||
else if !(previousMetronomeTracks.length == 0 && metronomeTracks.length == 0) && previousMetronomeTracks != metronomeTracks
|
||||
logger.debug("metronome state changed ", previousMetronomeTracks, metronomeTracks)
|
||||
#logger.debug("metronome state changed ", previousMetronomeTracks, metronomeTracks)
|
||||
MixerActions.syncTracks()
|
||||
else
|
||||
@refreshCurrentSession(true)
|
||||
|
|
@ -692,11 +692,14 @@ NotificationActions = @NotificationActions
|
|||
@leaveSessionRest(@currentSessionId)
|
||||
return
|
||||
|
||||
@updateSessionInfo(response, true)
|
||||
@issueChange()
|
||||
|
||||
logger.debug("calling jamClient.JoinSession");
|
||||
# on temporary disconnect scenarios, a user may already be in a session when they enter this path
|
||||
# so we avoid double counting
|
||||
unless @alreadyInSession()
|
||||
if response.music_session.participant_count == 1
|
||||
if @participants().length == 1
|
||||
context.JK.GA.trackSessionMusicians(context.JK.GA.SessionCreationTypes.create);
|
||||
else
|
||||
context.JK.GA.trackSessionMusicians(context.JK.GA.SessionCreationTypes.join);
|
||||
|
|
@ -705,7 +708,7 @@ NotificationActions = @NotificationActions
|
|||
|
||||
context.jamClient.JoinSession({sessionID: @currentSessionId});
|
||||
|
||||
@refreshCurrentSession(true);
|
||||
#@refreshCurrentSession(true);
|
||||
|
||||
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SESSION_JOIN, @trackChanges);
|
||||
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SESSION_DEPART, @trackChanges);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ context.JK.WebcamViewer = class WebcamViewer
|
|||
@webcamSelect.on("change", this.selectWebcam)
|
||||
@toggleBtn.on('click', @toggleWebcam)
|
||||
@resolutionSelect.on("change", this.selectResolution)
|
||||
logger.debug("Initialed with (unique) select",@webcamSelect)
|
||||
#logger.debug("Initialed with (unique) select",@webcamSelect)
|
||||
|
||||
beforeShow:() =>
|
||||
this.loadWebCams()
|
||||
|
|
|
|||
|
|
@ -300,7 +300,9 @@ class ApiMusicSessionsController < ApiController
|
|||
response.status = :unprocessable_entity
|
||||
respond_with @connection
|
||||
else
|
||||
respond_with @connection, responder: ApiResponder, :location => api_session_participant_detail_url(@connection.client_id)
|
||||
|
||||
@music_session = @connection.music_session
|
||||
respond_with @music_session, responder: ApiResponder, :status => 201, :location => api_session_detail_url(@connection.music_session)
|
||||
end
|
||||
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
|
|
|||
|
|
@ -1,13 +1,3 @@
|
|||
object @connection
|
||||
object @music_session
|
||||
|
||||
extends "api_music_sessions/participant_show"
|
||||
|
||||
attributes :music_session_id
|
||||
|
||||
child(:music_session => :music_session) {
|
||||
attributes :id
|
||||
|
||||
node :participant_count do |music_session|
|
||||
music_session.connections.length
|
||||
end
|
||||
}
|
||||
extends "api_music_sessions/show"
|
||||
Loading…
Reference in New Issue