How can I control the speed from an exo player via the UI to MediaBrowserServiceCompat?
Does Android provide a normal solution for it?
How can I control the speed from an exo player via the UI to MediaBrowserServiceCompat?
Does Android provide a normal solution for it?
In the end, I did it like this.
In the activity I did this:
MediaControllerCompat.getMediaController(ChatActivity.this).sendCommand("speed",bundle,new ResultReceiver(new Handler(Looper.getMainLooper()))
And in the MediaBrowserServiceCompat I did it like this:
private MediaSessionConnector.QueueEditor getQueueEditor() {
return new MediaSessionConnector.QueueEditor() {
@Override
public boolean onCommand(Player player, String command, @Nullable Bundle extras, @Nullable ResultReceiver cb) {
float speed = extras.getFloat("SpeedProgress");
PlaybackParameters param = new PlaybackParameters(speed);
player.setPlaybackParameters(param);
player.setPlaybackSpeed(speed);
return false;
}