List of usage examples for android.media MediaPlayer setSurface
public void setSurface(Surface surface)
From source file:nuclei.media.playback.FallbackPlayback.java
/** * Called when media player is done preparing. * * @see OnPreparedListener//from w ww. j a va2 s . com */ @Override public void onPrepared(MediaPlayer player) { mPrepared = true; // The media player is done preparing. That means we can start playing if we // have audio focus. if (mSurface != null && mSurface.isValid()) player.setSurface(mSurface); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (mPlaybackParams != null) player.setPlaybackParams(mPlaybackParams); } if (mMediaPlayer != null && mMetadata != null && mMetadata.getLong(MediaMetadataCompat.METADATA_KEY_DURATION) != mMediaPlayer.getDuration()) { mMetadata.setDuration(getDuration()); if (mCallback != null) mCallback.onMetadataChanged(mMetadata); } configMediaPlayerState(); }