Java Code Examples for android.media.PlaybackParams#getSpeed()

The following examples show how to use android.media.PlaybackParams#getSpeed() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleExoPlayer.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the {@link PlaybackParams} governing audio playback.
 *
 * @deprecated Use {@link #setPlaybackParameters(PlaybackParameters)}.
 * @param params The {@link PlaybackParams}, or null to clear any previously set parameters.
 */
@Deprecated
@TargetApi(23)
public void setPlaybackParams(@Nullable PlaybackParams params) {
  PlaybackParameters playbackParameters;
  if (params != null) {
    params.allowDefaults();
    playbackParameters = new PlaybackParameters(params.getSpeed(), params.getPitch());
  } else {
    playbackParameters = null;
  }
  setPlaybackParameters(playbackParameters);
}
 
Example 2
Source File: SimpleExoPlayer.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the {@link PlaybackParams} governing audio playback.
 *
 * @deprecated Use {@link #setPlaybackParameters(PlaybackParameters)}.
 * @param params The {@link PlaybackParams}, or null to clear any previously set parameters.
 */
@Deprecated
@TargetApi(23)
public void setPlaybackParams(@Nullable PlaybackParams params) {
  PlaybackParameters playbackParameters;
  if (params != null) {
    params.allowDefaults();
    playbackParameters = new PlaybackParameters(params.getSpeed(), params.getPitch());
  } else {
    playbackParameters = null;
  }
  setPlaybackParameters(playbackParameters);
}
 
Example 3
Source File: SimpleExoPlayer.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the {@link PlaybackParams} governing audio playback.
 *
 * @deprecated Use {@link #setPlaybackParameters(PlaybackParameters)}.
 * @param params The {@link PlaybackParams}, or null to clear any previously set parameters.
 */
@Deprecated
@TargetApi(23)
public void setPlaybackParams(@Nullable PlaybackParams params) {
  PlaybackParameters playbackParameters;
  if (params != null) {
    params.allowDefaults();
    playbackParameters = new PlaybackParameters(params.getSpeed(), params.getPitch());
  } else {
    playbackParameters = null;
  }
  setPlaybackParameters(playbackParameters);
}
 
Example 4
Source File: BaseTvInputService.java    From xipl with Apache License 2.0 5 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void onTimeShiftSetPlaybackParams(PlaybackParams params) {
    if (params.getSpeed() != 1.0f) {
        mHandler.removeMessages(MSG_PLAY_AD);
        mDbHandler.removeCallbacks(mGetCurrentProgramRunnable);
    }

    if (DEBUG) {
        Log.d(TAG, "Set playback speed to " + params.getSpeed());
    }
    if (getTvPlayer() != null) {
        getTvPlayer().setPlaybackParams(params);
    }
}
 
Example 5
Source File: AudioTrack.java    From K-Sonic with MIT License 5 votes vote down vote up
@Override
public void setPlaybackParams(PlaybackParams playbackParams) {
  playbackParams = (playbackParams != null ? playbackParams : new PlaybackParams())
      .allowDefaults();
  this.playbackParams = playbackParams;
  playbackSpeed = playbackParams.getSpeed();
  maybeApplyPlaybackParams();
}
 
Example 6
Source File: CumulusTvPlayer.java    From CumulusTV with MIT License 5 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void setPlaybackParams(PlaybackParams params) {
    mSimpleExoPlayer.setPlaybackParams(params);
    mPlaybackSpeed = params.getSpeed();
    if (DEBUG) {
        Log.d(TAG, "Set params " + params.toString());
    }
}
 
Example 7
Source File: BaseTvInputService.java    From androidtv-sample-inputs with Apache License 2.0 5 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void onTimeShiftSetPlaybackParams(PlaybackParams params) {
    if (params.getSpeed() != 1.0f) {
        mHandler.removeMessages(MSG_PLAY_AD);
        mDbHandler.removeCallbacks(mGetCurrentProgramRunnable);
    }

    if (DEBUG) {
        Log.d(TAG, "Set playback speed to " + params.getSpeed());
    }
    if (getTvPlayer() != null) {
        getTvPlayer().setPlaybackParams(params);
    }
}
 
Example 8
Source File: SimpleExoPlayer.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the {@link PlaybackParams} governing audio playback.
 *
 * @deprecated Use {@link #setPlaybackParameters(PlaybackParameters)}.
 * @param params The {@link PlaybackParams}, or null to clear any previously set parameters.
 */
@Deprecated
@TargetApi(23)
public void setPlaybackParams(@Nullable PlaybackParams params) {
  PlaybackParameters playbackParameters;
  if (params != null) {
    params.allowDefaults();
    playbackParameters = new PlaybackParameters(params.getSpeed(), params.getPitch());
  } else {
    playbackParameters = null;
  }
  setPlaybackParameters(playbackParameters);
}
 
Example 9
Source File: SimpleExoPlayer.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the {@link PlaybackParams} governing audio playback.
 *
 * @deprecated Use {@link #setPlaybackParameters(PlaybackParameters)}.
 * @param params The {@link PlaybackParams}, or null to clear any previously set parameters.
 */
@Deprecated
@TargetApi(23)
public void setPlaybackParams(@Nullable PlaybackParams params) {
  PlaybackParameters playbackParameters;
  if (params != null) {
    params.allowDefaults();
    playbackParameters = new PlaybackParameters(params.getSpeed(), params.getPitch());
  } else {
    playbackParameters = null;
  }
  setPlaybackParameters(playbackParameters);
}