*wip
This commit is contained in:
parent
c4c05c67d6
commit
503e46ed74
|
|
@ -1,8 +1,8 @@
|
|||
CREATE TABLE backing_tracks (
|
||||
CREATE UNLOGGED TABLE backing_tracks (
|
||||
id VARCHAR(64) NOT NULL PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
filename VARCHAR(1024) NOT NULL,
|
||||
|
||||
connection_id VARCHAR(64) NOT NULL,
|
||||
connection_id VARCHAR(64) NOT NULL REFERENCES connections(id) ON DELETE CASCADE,
|
||||
client_track_id VARCHAR(64) NOT NULL,
|
||||
client_resource_id VARCHAR(100),
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ CREATE TABLE backing_tracks (
|
|||
CREATE TABLE recorded_backing_tracks (
|
||||
id BIGINT PRIMARY KEY,
|
||||
user_id VARCHAR(64) REFERENCES users(id) ON DELETE CASCADE,
|
||||
backing_track_id VARCHAR(64) REFERENCES backing_tracks(id) ON DELETE CASCADE,
|
||||
backing_track_id VARCHAR(64),
|
||||
recording_id VARCHAR(64) NOT NULL,
|
||||
|
||||
client_track_id VARCHAR(64) NOT NULL,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@
|
|||
emptyList();
|
||||
resetPagination();
|
||||
showing = true;
|
||||
getBackingTracks()
|
||||
getBackingTracks();
|
||||
$dialog.data('result', null);
|
||||
// .done(function(data, textStatus, jqXHR) {
|
||||
// // initialize pagination
|
||||
// var $paginator = context.JK.Paginator.create(parseInt(jqXHR.getResponseHeader('total-entries')), perPage, 0, onPageSelected)
|
||||
|
|
@ -93,6 +94,8 @@
|
|||
// TODO: Possibly actually check the result. Investigate
|
||||
// what real client returns:
|
||||
// // if(result) {
|
||||
// let callers see which backing track was chosen
|
||||
$dialog.data('result', backingTrack);
|
||||
app.layout.closeDialog('open-backing-track-dialog');
|
||||
// }
|
||||
// else {
|
||||
|
|
|
|||
|
|
@ -2152,8 +2152,11 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
app.layout.showDialog('open-backing-track-dialog');
|
||||
|
||||
app.layout.showDialog('open-backing-track-dialog').one(EVENTS.DIALOG_CLOSED, function(e, data) {
|
||||
if(!data.cancel && data.result){
|
||||
sessionModel.setBackingTrack(data.result);
|
||||
}
|
||||
})
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2184,7 +2187,7 @@
|
|||
return false;
|
||||
} else {
|
||||
context.jamClient.openBackingTrackFile(sessionModel.backing_track)
|
||||
context.JK.CurrentSessionModel.refreshCurrentSession(true);
|
||||
//context.JK.CurrentSessionModel.refreshCurrentSession(true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2294,14 +2297,15 @@
|
|||
closeMetronomeTrack();
|
||||
}
|
||||
else {
|
||||
logger.error("don't know how to close open media (backing track?)");
|
||||
logger.error("don't know how to close open media");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function closeBackingTrack() {
|
||||
rest.closeBackingTrack({id: sessionModel.id()})
|
||||
.done(function() {
|
||||
sessionModel.refreshCurrentSession(true);
|
||||
//sessionModel.refreshCurrentSession(true);
|
||||
})
|
||||
.fail(function(jqXHR) {
|
||||
app.notify({
|
||||
|
|
@ -2311,7 +2315,8 @@
|
|||
});
|
||||
});
|
||||
|
||||
context.jamClient.SessionCloseBackingTrackFile();
|
||||
// '' closes all open backing tracks
|
||||
context.jamClient.SessionCloseBackingTrackFile('');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
var sessionPageEnterTimeout = null;
|
||||
var startTime = null;
|
||||
var joinDeferred = null;
|
||||
var previousBackingTracks = [];
|
||||
var openBackingTrack = null;
|
||||
|
||||
var mixerMode = MIX_MODES.PERSONAL;
|
||||
|
||||
|
|
@ -324,6 +326,8 @@
|
|||
}
|
||||
currentSessionId = null;
|
||||
currentParticipants = {}
|
||||
previousBackingTracks = []
|
||||
openBackingTrack = null
|
||||
}
|
||||
|
||||
// you should only update currentSession with this function
|
||||
|
|
@ -557,23 +561,31 @@
|
|||
return mixerMode;
|
||||
}
|
||||
|
||||
function syncTracks() {
|
||||
function syncTracks(backingTracks) {
|
||||
// double check that we are in session, since a bunch could have happened since then
|
||||
if(!inSession()) {
|
||||
logger.debug("dropping queued up sync tracks because no longer in session");
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
// this is a local change to our tracks. we need to tell the server about our updated track information
|
||||
var inputTracks = context.JK.TrackHelpers.getUserTracks(context.jamClient);
|
||||
|
||||
// backingTracks can be passed in as an optimization, so that we don't hit the backend excessively
|
||||
if(backingTracks === undefined) {
|
||||
backingTracks = context.JK.TrackHelpers.getBackingTracks(context.jamClient);
|
||||
}
|
||||
|
||||
console.log('backingTracks', backingTracks);
|
||||
|
||||
// create a trackSync request based on backend data
|
||||
var syncTrackRequest = {};
|
||||
syncTrackRequest.client_id = app.clientId;
|
||||
syncTrackRequest.tracks = inputTracks;
|
||||
syncTrackRequest.backing_tracks = backingTracks;
|
||||
syncTrackRequest.id = id();
|
||||
|
||||
rest.putTrackSyncChange(syncTrackRequest)
|
||||
return rest.putTrackSyncChange(syncTrackRequest)
|
||||
.done(function() {
|
||||
})
|
||||
.fail(function(jqXHR) {
|
||||
|
|
@ -733,7 +745,6 @@
|
|||
// wait until we are fully in session before trying to sync tracks to server
|
||||
if(joinDeferred) {
|
||||
joinDeferred.done(function() {
|
||||
|
||||
syncTracks();
|
||||
})
|
||||
}
|
||||
|
|
@ -742,8 +753,17 @@
|
|||
}
|
||||
else if(inSession() && (text == 'RebuildMediaControl' || text == 'RebuildRemoteUserControl')) {
|
||||
|
||||
//
|
||||
refreshCurrentSession(true);
|
||||
var backingTracks = context.JK.TrackHelpers.getBackingTracks(context.jamClient);
|
||||
|
||||
// the way we know if backing tracks changes, or recordings are opened, is via this event.
|
||||
// but we want to report to the user when backing tracks change; so we need to detect change on our own
|
||||
if(previousBackingTracks != backingTracks) {
|
||||
logger.debug("backing tracks changed")
|
||||
syncTracks(backingTracks);
|
||||
}
|
||||
else {
|
||||
refreshCurrentSession(true);
|
||||
}
|
||||
}
|
||||
else if(inSession() && (text == 'Global Peer Input Mixer Mode')) {
|
||||
setMixerMode(MIX_MODES.MASTER);
|
||||
|
|
@ -796,6 +816,12 @@
|
|||
this.getParticipant = function(clientId) {
|
||||
return participantsEverSeen[clientId]
|
||||
};
|
||||
this.setBackingTrack = function(backingTrack) {
|
||||
openBackingTrack = backingTrack;
|
||||
};
|
||||
this.getBackingTrack = function() {
|
||||
return openBackingTrack;
|
||||
};
|
||||
|
||||
// call to report if the current user was able to establish audio with the specified clientID
|
||||
this.setAudioEstablished = function(clientId, audioEstablished) {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,22 @@
|
|||
return tracks;
|
||||
},
|
||||
|
||||
getBackingTracks: function(jamClient) {
|
||||
var mediaTracks = context.JK.TrackHelpers.getTracks(jamClient, 4);
|
||||
|
||||
|
||||
var backingTracks = []
|
||||
context._.each(mediaTracks, function(mediaTrack) {
|
||||
var track = {};
|
||||
track.client_track_id = mediaTrack.id;
|
||||
track.client_resource_id = mediaTrack.rid;
|
||||
track.filename = mediaTrack.id;
|
||||
backingTracks.push(track);
|
||||
})
|
||||
|
||||
return backingTracks;
|
||||
},
|
||||
|
||||
/**
|
||||
* This function resolves which tracks to configure for a user
|
||||
* when creating or joining a session. By default, tracks are pulled
|
||||
|
|
|
|||
Loading…
Reference in New Issue