Search in sources :

Example 1 with MediaChannelResult

use of com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult in project ExoPlayer by google.

the class CastPlayer method setPlaybackParameters.

@Override
public void setPlaybackParameters(PlaybackParameters playbackParameters) {
    if (remoteMediaClient == null) {
        return;
    }
    PlaybackParameters actualPlaybackParameters = new PlaybackParameters(Util.constrainValue(playbackParameters.speed, MIN_SPEED_SUPPORTED, MAX_SPEED_SUPPORTED));
    setPlaybackParametersAndNotifyIfChanged(actualPlaybackParameters);
    listeners.flushEvents();
    PendingResult<MediaChannelResult> pendingResult = remoteMediaClient.setPlaybackRate(actualPlaybackParameters.speed, /* customData= */
    null);
    this.playbackParameters.pendingResultCallback = new ResultCallback<MediaChannelResult>() {

        @Override
        public void onResult(MediaChannelResult mediaChannelResult) {
            if (remoteMediaClient != null) {
                updatePlaybackRateAndNotifyIfChanged(this);
                listeners.flushEvents();
            }
        }
    };
    pendingResult.setResultCallback(this.playbackParameters.pendingResultCallback);
}
Also used : MediaChannelResult(com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult) PlaybackParameters(com.google.android.exoplayer2.PlaybackParameters)

Aggregations

PlaybackParameters (com.google.android.exoplayer2.PlaybackParameters)1 MediaChannelResult (com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult)1