private void assertMediaStateIs(@PlaybackStateCompat.State int expectedState) { PlaybackState state = rule.getActivity().getMediaController().getPlaybackState(); assertNotNull(state); assertThat( "MediaSession is not in the correct state", state.getState(), is(equalTo(expectedState))); }
public static long getPosition(Object stateObj) { return ((PlaybackState)stateObj).getPosition(); }
public static long getLastPositionUpdateTime(Object stateObj) { return ((PlaybackState)stateObj).getLastPositionUpdateTime(); }
private void updatePlayback(PlaybackState state) { if (this.mNowPlayCardListener != null && state != null) { this.mNowPlayCardListener.onClientPlaybackStateUpdate(state.getState(), state.getLastPositionUpdateTime(), state.getPosition()); } }
public static CharSequence getErrorMessage(Object stateObj) { return ((PlaybackState)stateObj).getErrorMessage(); }
public static float getPlaybackSpeed(Object stateObj) { return ((PlaybackState)stateObj).getPlaybackSpeed(); }
public static long getActions(Object stateObj) { return ((PlaybackState)stateObj).getActions(); }
public static long getBufferedPosition(Object stateObj) { return ((PlaybackState)stateObj).getBufferedPosition(); }
public static int getState(Object stateObj) { return ((PlaybackState)stateObj).getState(); }
long getPosition() { if (controller.getPlaybackState() == null) return 0; return controller.getPlaybackState().getPosition(); } }
MprisReceiverPlayer(MediaController controller, String name) { this.controller = controller; this.name = name; if (controller.getPlaybackState() != null) { isPlaying = controller.getPlaybackState().getState() == PlaybackState.STATE_PLAYING; } }
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override public void onPlaybackStateChanged(@NonNull PlaybackState state) { switch (state.getState()) { case PlaybackState.STATE_PLAYING: player.setPlaying(true); plugin.sendPlaying(player); break; case PlaybackState.STATE_PAUSED: player.setPaused(true); plugin.sendPlaying(player); break; } }