VRFS-1333 play tracking
This commit is contained in:
parent
eb98b97cd5
commit
38bde04ec7
|
|
@ -92,11 +92,11 @@
|
|||
});
|
||||
}
|
||||
|
||||
function addPlayablePlay(playableId, claimedRecordingId, userId) {
|
||||
function addPlayablePlay(playableId, playableType, claimedRecordingId, userId) {
|
||||
return $.ajax({
|
||||
url: '/api/users/' + playableId + "/plays",
|
||||
type: "POST",
|
||||
data : JSON.stringify({user_id: userId, claimed_recording_id: claimedRecordingId}),
|
||||
data : JSON.stringify({user_id: userId, claimed_recording_id: claimedRecordingId, playable_type: playableType}),
|
||||
dataType : 'json',
|
||||
contentType: 'application/json'
|
||||
});
|
||||
|
|
|
|||
|
|
@ -74,10 +74,8 @@
|
|||
waitForLoaded().done(function() {
|
||||
if(lastTime > -1) {audioDomElement.currentTime = lastTime;}
|
||||
audioDomElement.play();
|
||||
transition(PlayStateInitializing);
|
||||
// keep this after transition, because any transition clears this timer
|
||||
waitForBufferingTimeout = setTimeout(noBuffer, WAIT_FOR_BUFFER_TIMEOUT);
|
||||
//context.JK.Rest().addPlayablePlay(null, null, context.JK.currentUserId);
|
||||
isPlaying = true;
|
||||
context.JK.Rest().addPlayablePlay(null, null, null, context.JK.currentUserId);
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,13 +148,13 @@ class ApiRecordingsController < ApiController
|
|||
|
||||
def add_play
|
||||
if params[:id].blank?
|
||||
render :json => { :message => "Recording ID is required" }, :status => 400
|
||||
render :json => { :message => "Playable ID is required" }, :status => 400
|
||||
return
|
||||
end
|
||||
|
||||
play = PlayablePlay.new
|
||||
play.playable_id = params[:id]
|
||||
play.playable_type = 'JamRuby::Recording'
|
||||
play.playable_type = params[:playable_type]
|
||||
play.player_id = params[:user_id]
|
||||
play.claimed_recording_id = params[:claimed_recording_id]
|
||||
play.ip_address = request.remote_ip
|
||||
|
|
|
|||
Loading…
Reference in New Issue