diff --git a/web/app/assets/javascripts/jam_rest.js b/web/app/assets/javascripts/jam_rest.js index 604b0ba38..c8ece8424 100644 --- a/web/app/assets/javascripts/jam_rest.js +++ b/web/app/assets/javascripts/jam_rest.js @@ -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' }); diff --git a/web/app/assets/javascripts/jquery.listenRecording.js b/web/app/assets/javascripts/jquery.listenRecording.js index a84353e1e..3b4aea849 100644 --- a/web/app/assets/javascripts/jquery.listenRecording.js +++ b/web/app/assets/javascripts/jquery.listenRecording.js @@ -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); }) } diff --git a/web/app/controllers/api_recordings_controller.rb b/web/app/controllers/api_recordings_controller.rb index 340bcba90..2d92886e7 100644 --- a/web/app/controllers/api_recordings_controller.rb +++ b/web/app/controllers/api_recordings_controller.rb @@ -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