Java 类com.google.android.exoplayer2.PlaybackParameters 实例源码

项目:nuclei-android    文件:PlaybackManager.java   
public void handlePrepareRequest() {
    mPendingAutoContinue = false;
    if (mMediaMetadata != null) {
        final MediaId id = MediaProvider.getInstance().getMediaId(mMediaMetadata.getDescription().getMediaId());
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            if (id.type == MediaId.TYPE_AUDIO)
                mPlayback.setPlaybackParams(new PlaybackParameters(mServiceCallback.getAudioSpeed(), 1));
            else
                mPlayback.setPlaybackParams(PlaybackParameters.DEFAULT);
        }
        mServiceCallback.onPlaybackPrepare(id);
        mPlayback.prepare(mMediaMetadata);

        mHandler.removeMessages(TIMER_COUNTDOWN);
        mHandler.removeMessages(TIMER_TIMING);

        if (mQueue != null && !mQueue.setMetadata(mMediaMetadata)) {
            mQueue = null;
            mServiceCallback.onQueue(null);
        }
    }
}
项目:nuclei-android    文件:FallbackPlayback.java   
@Override
public void setPlaybackParams(PlaybackParameters playbackParams) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (mMediaPlayer == null || !mPrepared) {
            mPlaybackParams = new PlaybackParams().setSpeed(playbackParams.speed).setPitch(playbackParams.pitch);
        } else {
            mMediaPlayer.setPlaybackParams(new PlaybackParams().setSpeed(playbackParams.speed).setPitch(playbackParams.pitch));

            if (mState != PlaybackStateCompat.STATE_PLAYING && mMediaPlayer.isPlaying()) {
                mState = PlaybackStateCompat.STATE_PLAYING;
            }
            if (mCallback != null) {
                mCallback.onPlaybackStatusChanged(mState);
            }
        }
    }
}
项目:Exoplayer2Radio    文件:StandaloneMediaClock.java   
@Override
public PlaybackParameters setPlaybackParameters(PlaybackParameters playbackParameters) {
  // Store the current position as the new base, in case the playback speed has changed.
  if (started) {
    setPositionUs(getPositionUs());
  }
  this.playbackParameters = playbackParameters;
  return playbackParameters;
}
项目:Exoplayer2Radio    文件:AudioTrack.java   
/**
 * @param audioCapabilities The audio capabilities for playback on this device. May be null if the
 *     default capabilities (no encoded audio passthrough support) should be assumed.
 * @param audioProcessors An array of {@link AudioProcessor}s that will process PCM audio before
 *     output. May be empty.
 * @param listener Listener for audio track events.
 */
public AudioTrack(AudioCapabilities audioCapabilities, AudioProcessor[] audioProcessors,
    Listener listener) {
  this.audioCapabilities = audioCapabilities;
  this.listener = listener;
  releasingConditionVariable = new ConditionVariable(true);
  if (Util.SDK_INT >= 18) {
    try {
      getLatencyMethod =
          android.media.AudioTrack.class.getMethod("getLatency", (Class<?>[]) null);
    } catch (NoSuchMethodException e) {
      // There's no guarantee this method exists. Do nothing.
    }
  }
  if (Util.SDK_INT >= 19) {
    audioTrackUtil = new AudioTrackUtilV19();
  } else {
    audioTrackUtil = new AudioTrackUtil();
  }
  channelMappingAudioProcessor = new ChannelMappingAudioProcessor();
  sonicAudioProcessor = new SonicAudioProcessor();
  availableAudioProcessors = new AudioProcessor[3 + audioProcessors.length];
  availableAudioProcessors[0] = new ResamplingAudioProcessor();
  availableAudioProcessors[1] = channelMappingAudioProcessor;
  System.arraycopy(audioProcessors, 0, availableAudioProcessors, 2, audioProcessors.length);
  availableAudioProcessors[2 + audioProcessors.length] = sonicAudioProcessor;
  playheadOffsets = new long[MAX_PLAYHEAD_OFFSET_COUNT];
  volume = 1.0f;
  startMediaTimeState = START_NOT_SET;
  streamType = C.STREAM_TYPE_DEFAULT;
  audioSessionId = C.AUDIO_SESSION_ID_UNSET;
  playbackParameters = PlaybackParameters.DEFAULT;
  drainingAudioProcessorIndex = C.INDEX_UNSET;
  this.audioProcessors = new AudioProcessor[0];
  outputBuffers = new ByteBuffer[0];
  playbackParametersCheckpoints = new LinkedList<>();
}
项目:nuclei-android    文件:PlaybackManager.java   
public void handlePlayRequest() {
    mPendingAutoContinue = false;
    if (mMediaMetadata != null) {
        final MediaId id = MediaProvider.getInstance().getMediaId(mMediaMetadata.getDescription().getMediaId());
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            if (id.type == MediaId.TYPE_AUDIO)
                mPlayback.setPlaybackParams(new PlaybackParameters(mServiceCallback.getAudioSpeed(), 1));
            else
                mPlayback.setPlaybackParams(PlaybackParameters.DEFAULT);
        }
        mServiceCallback.onPlaybackStart(id);
        mServiceCallback.onNotificationRequired();
        mPlayback.start();
        mPlayback.play(mMediaMetadata);

        if (mTimer > -1) {
            mHandler.removeMessages(TIMER_COUNTDOWN);
            mHandler.sendEmptyMessageDelayed(TIMER_COUNTDOWN, ONE_SECOND);
        }

        if (mPlayback.getTiming() != null) {
            mHandler.removeMessages(TIMER_TIMING);
            mHandler.sendEmptyMessageDelayed(TIMER_TIMING, ONE_SECOND);
        }

        if (mQueue != null && !mQueue.setMetadata(mMediaMetadata)) {
            mQueue = null;
            mServiceCallback.onQueue(null);
        }
    }
}
项目:nuclei-android    文件:PlaybackManager.java   
@Override
public void onCustomAction(@NonNull String action, Bundle extras) {
    switch (action) {
        case MediaService.ACTION_SET_SURFACE:
            final long surfaceId = extras.getLong(MediaService.EXTRA_SURFACE_ID);
            if (!extras.containsKey(MediaService.EXTRA_SURFACE)) {
                mPlayback.setSurface(surfaceId, null);
            } else {
                final Surface surface = extras.getParcelable(MediaService.EXTRA_SURFACE);
                mPlayback.setSurface(surfaceId, surface);
            }
            break;
        case MediaService.ACTION_SET_SPEED:
            final float speed = extras.getFloat(MediaService.EXTRA_SPEED);
            mServiceCallback.onSpeedSet(speed);
            mPlayback.setPlaybackParams(new PlaybackParameters(speed, 1));
            break;
        case MediaService.ACTION_SET_TIMER:
            mTimer = extras.getLong(MediaService.EXTRA_TIMER);
            mHandler.removeMessages(TIMER_COUNTDOWN);
            if (mTimer != -1)
                mHandler.sendEmptyMessageDelayed(TIMER_COUNTDOWN, ONE_SECOND);
            mServiceCallback.onTimerCount(mTimer);
            break;
        case MediaService.ACTION_SET_AUTO_CONTINUE:
            final boolean autoContinue = extras.getBoolean(MediaService.EXTRA_AUTO_CONTINUE);
            mServiceCallback.onAutoContinueSet(autoContinue);
            break;
        default:
            break;
    }
}
项目:nuclei-android    文件:ExoPlayerPlayback.java   
@Override
public void setPlaybackParams(PlaybackParameters playbackParams) {
    mPlaybackParams = playbackParams;
    if (mMediaPlayer != null)
        mMediaPlayer.setPlaybackParameters(playbackParams);
    if (mCallback != null)
        mCallback.onPlaybackStatusChanged(mState);
}
项目:GSYVideoPlayer    文件:IjkExo2MediaPlayer.java   
/**
 * 倍速播放
 *
 * @param speed 倍速播放,默认为1
 * @param pitch 音量缩放,默认为1,修改会导致声音变调
 */
public void setSpeed(@Size(min = 0) float speed, @Size(min = 0) float pitch) {
    PlaybackParameters playbackParameters = new PlaybackParameters(speed, pitch);
    mSpeedPlaybackParameters = playbackParameters;
    if (mInternalPlayer != null) {
        mInternalPlayer.setPlaybackParameters(playbackParameters);
    }
}
项目:no-player    文件:EventInfoForwarder.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
    HashMap<String, String> callingMethodParameters = new HashMap<>();

    callingMethodParameters.put("playbackParameters", String.valueOf(playbackParameters));

    infoListener.onNewInfo("onPlaybackParametersChanged", callingMethodParameters);
}
项目:transistor    文件:StandaloneMediaClock.java   
@Override
public PlaybackParameters setPlaybackParameters(PlaybackParameters playbackParameters) {
  // Store the current position as the new base, in case the playback speed has changed.
  if (started) {
    setPositionUs(getPositionUs());
  }
  this.playbackParameters = playbackParameters;
  return playbackParameters;
}
项目:transistor    文件:DefaultAudioSink.java   
/**
 * @param audioCapabilities The audio capabilities for playback on this device. May be null if the
 *     default capabilities (no encoded audio passthrough support) should be assumed.
 * @param audioProcessors An array of {@link AudioProcessor}s that will process PCM audio before
 *     output. May be empty.
 */
public DefaultAudioSink(@Nullable AudioCapabilities audioCapabilities,
    AudioProcessor[] audioProcessors) {
  this.audioCapabilities = audioCapabilities;
  releasingConditionVariable = new ConditionVariable(true);
  if (Util.SDK_INT >= 18) {
    try {
      getLatencyMethod =
          AudioTrack.class.getMethod("getLatency", (Class<?>[]) null);
    } catch (NoSuchMethodException e) {
      // There's no guarantee this method exists. Do nothing.
    }
  }
  if (Util.SDK_INT >= 19) {
    audioTrackUtil = new AudioTrackUtilV19();
  } else {
    audioTrackUtil = new AudioTrackUtil();
  }
  channelMappingAudioProcessor = new ChannelMappingAudioProcessor();
  trimmingAudioProcessor = new TrimmingAudioProcessor();
  sonicAudioProcessor = new SonicAudioProcessor();
  availableAudioProcessors = new AudioProcessor[4 + audioProcessors.length];
  availableAudioProcessors[0] = new ResamplingAudioProcessor();
  availableAudioProcessors[1] = channelMappingAudioProcessor;
  availableAudioProcessors[2] = trimmingAudioProcessor;
  System.arraycopy(audioProcessors, 0, availableAudioProcessors, 3, audioProcessors.length);
  availableAudioProcessors[3 + audioProcessors.length] = sonicAudioProcessor;
  playheadOffsets = new long[MAX_PLAYHEAD_OFFSET_COUNT];
  volume = 1.0f;
  startMediaTimeState = START_NOT_SET;
  audioAttributes = AudioAttributes.DEFAULT;
  audioSessionId = C.AUDIO_SESSION_ID_UNSET;
  playbackParameters = PlaybackParameters.DEFAULT;
  drainingAudioProcessorIndex = C.INDEX_UNSET;
  this.audioProcessors = new AudioProcessor[0];
  outputBuffers = new ByteBuffer[0];
  playbackParametersCheckpoints = new ArrayDeque<>();
}
项目:yjPlay    文件:ExoUserPlayer.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
}
项目:AesExoPlayer    文件:TestPlayerActivity.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
    Timber.e("播放: onPlaybackParametersChanged  ");
}
项目:TubiPlayer    文件:TubiExoPlayerView.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
    // Do nothing.
}
项目:B4A_ExoPlayer    文件:SimpleExoPlayerWrapper.java   
/**
 * Initializes the player.
 */
public void Initialize(final BA ba, String EventName) {
    eventName = EventName.toLowerCase(BA.cul);
    BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
    TrackSelection.Factory videoTrackSelectionFactory =
        new AdaptiveTrackSelection.Factory(bandwidthMeter);
    trackSelector =
        new DefaultTrackSelector(videoTrackSelectionFactory);

    player = ExoPlayerFactory.newSimpleInstance(BA.applicationContext, trackSelector);
    player.addListener(new Player.EventListener() {

        @Override
        public void onLoadingChanged(boolean isLoading) {
        }

        @Override
        public void onPlayerError(ExoPlaybackException error) {
            ba.raiseEvent(SimpleExoPlayerWrapper.this, eventName + "_error", String.valueOf(error.getCause()));
        }

        @Override
        public void onPlayerStateChanged(boolean playWhenReady,
                int playbackState) {
            if (playbackState != currentState) {
                currentState = playbackState;
                if (currentState == Player.STATE_ENDED)
                    ba.raiseEvent(SimpleExoPlayerWrapper.this, eventName + "_complete");
                else if (currentState == Player.STATE_READY)
                    ba.raiseEvent(SimpleExoPlayerWrapper.this, eventName + "_ready");
            }
        }

        @Override
        public void onPositionDiscontinuity() {

        }

        @Override
        public void onTimelineChanged(Timeline timeline, Object manifest) {
        }

        @Override
        public void onPlaybackParametersChanged(
                PlaybackParameters playbackParameters) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onRepeatModeChanged(int repeatMode) {

        }

        @Override
        public void onTracksChanged(TrackGroupArray trackGroups,
                TrackSelectionArray trackSelections) {
            ba.raiseEventFromUI(SimpleExoPlayerWrapper.this, eventName + "_trackchanged");
        }

    });
}
项目:AndroidAudioExample    文件:PlayerService.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
}
项目:Exoplayer2Radio    文件:StandaloneMediaClock.java   
/**
 * Creates a new standalone media clock.
 */
public StandaloneMediaClock() {
  playbackParameters = PlaybackParameters.DEFAULT;
}
项目:Exoplayer2Radio    文件:StandaloneMediaClock.java   
@Override
public PlaybackParameters getPlaybackParameters() {
  return playbackParameters;
}
项目:Exoplayer2Radio    文件:SimpleDecoderAudioRenderer.java   
@Override
public PlaybackParameters setPlaybackParameters(PlaybackParameters playbackParameters) {
  return audioTrack.setPlaybackParameters(playbackParameters);
}
项目:Exoplayer2Radio    文件:SimpleDecoderAudioRenderer.java   
@Override
public PlaybackParameters getPlaybackParameters() {
  return audioTrack.getPlaybackParameters();
}
项目:Exoplayer2Radio    文件:MediaCodecAudioRenderer.java   
@Override
public PlaybackParameters setPlaybackParameters(PlaybackParameters playbackParameters) {
  return audioTrack.setPlaybackParameters(playbackParameters);
}
项目:Exoplayer2Radio    文件:MediaCodecAudioRenderer.java   
@Override
public PlaybackParameters getPlaybackParameters() {
  return audioTrack.getPlaybackParameters();
}
项目:Exoplayer2Radio    文件:AudioTrack.java   
/**
 * Gets the {@link PlaybackParameters}.
 */
public PlaybackParameters getPlaybackParameters() {
  return playbackParameters;
}
项目:Exoplayer2Radio    文件:AudioTrack.java   
private PlaybackParametersCheckpoint(PlaybackParameters playbackParameters, long mediaTimeUs,
    long positionUs) {
  this.playbackParameters = playbackParameters;
  this.mediaTimeUs = mediaTimeUs;
  this.positionUs = positionUs;
}
项目:zapp    文件:VideoBufferingHandler.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
}
项目:nuclei-android    文件:CastPlayback.java   
@Override
public void setPlaybackParams(PlaybackParameters playbackParams) {
    if (mCallback != null)
        mCallback.onPlaybackStatusChanged(mState);
}
项目:GSYVideoPlayer    文件:EventLogger.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
  Log.d(TAG, "playbackParameters " + String.format(
          "[speed=%.2f, pitch=%.2f]", playbackParameters.speed, playbackParameters.pitch));
}
项目:GSYVideoPlayer    文件:SimpleExoPlayer2.java   
@Override
public void setPlaybackParameters(PlaybackParameters playbackParameters) {
  player.setPlaybackParameters(playbackParameters);
}
项目:GSYVideoPlayer    文件:SimpleExoPlayer2.java   
@Override
public PlaybackParameters getPlaybackParameters() {
  return player.getPlaybackParameters();
}
项目:YouTube-In-Background    文件:LocalPlayback.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters)
{
    // Nothing to do.
}
项目:no-player    文件:OnPrepareForwarder.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
    // TODO: should we send?
}
项目:no-player    文件:OnCompletionForwarder.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
    // TODO: should we send?
}
项目:no-player    文件:BufferStateForwarder.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
    // TODO: should we send?
}
项目:no-player    文件:PlayerOnErrorForwarder.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
    // TODO: should we send?
}
项目:no-player    文件:OnCompletionStateChangedForwarder.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
    // TODO: should we send?
}
项目:no-player    文件:EventListener.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
    for (Player.EventListener listener : listeners) {
        listener.onPlaybackParametersChanged(playbackParameters);
    }
}
项目:Radio2    文件:RadioService.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {}
项目:ExoPlayerVideoView    文件:ExoVideoView.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
}
项目:android-UniversalMusicPlayer    文件:LocalPlayback.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
    // Nothing to do.
}
项目:stepik-android    文件:PlaybackControlView.java   
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
    // Do nothing.
}