Fixed next track not autoplaying on gmediarenderer.

This commit is contained in:
Felix Ableitner 2014-04-13 13:01:29 +02:00
parent 2997938e18
commit 5aa6ae6ed8

View file

@ -243,7 +243,6 @@ public class RemotePlayServiceBinder extends IRemotePlayService.Stub {
@Override @Override
public void success(ActionInvocation invocation) { public void success(ActionInvocation invocation) {
Log.d(TAG, "play success");
mPlaybackState = MediaItemStatus.PLAYBACK_STATE_PLAYING; mPlaybackState = MediaItemStatus.PLAYBACK_STATE_PLAYING;
mStartingPlayback = false; mStartingPlayback = false;
} }
@ -369,20 +368,17 @@ public class RemotePlayServiceBinder extends IRemotePlayService.Stub {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@Override @Override
public void received(ActionInvocation invocation, PositionInfo positionInfo) { public void received(ActionInvocation invocation, PositionInfo positionInfo) {
if (positionInfo.getTrackURI() == null)
return;
Message msg = Message.obtain(null, Provider.MSG_STATUS_INFO, 0, 0); Message msg = Message.obtain(null, Provider.MSG_STATUS_INFO, 0, 0);
Builder status = null; Builder status = null;
if (positionInfo.getTrackURI().equals(itemId)) if (positionInfo.getTrackURI() != null && positionInfo.getTrackURI().equals(itemId))
status = new MediaItemStatus.Builder(mPlaybackState) status = new MediaItemStatus.Builder(mPlaybackState)
.setContentPosition(positionInfo.getTrackElapsedSeconds() * 1000) .setContentPosition(positionInfo.getTrackElapsedSeconds() * 1000)
.setContentDuration(positionInfo.getTrackDurationSeconds() * 1000) .setContentDuration(positionInfo.getTrackDurationSeconds() * 1000)
.setTimestamp(positionInfo.getAbsCount()); .setTimestamp(positionInfo.getAbsCount());
else else
status = new MediaItemStatus.Builder( status = new MediaItemStatus.Builder(mPlaybackState);
MediaItemStatus.PLAYBACK_STATE_INVALIDATED);
msg.getData().putBundle("media_item_status", status.build().asBundle()); msg.getData().putBundle("media_item_status", status.build().asBundle());
msg.getData().putInt("hash", requestHash); msg.getData().putInt("hash", requestHash);