I am currently trying to find a solution to the same problem. The best thing I've come up with is the following.
In 4.2, I noticed that the following callbacks were received:
1) onVideoSizeChanged () - where height and width = 0
2) onPrepared ()
3) onVideoSizeChanged () - correct heights and widths
You cannot call seekTo in (1) because the player is not yet prepared.
, seekTo (2), " "
(3), MediaPlayer.start(), seekTo().
MediaPlayer mMediaPlayer = new MediaPlayer();
boolean mVideoSizeIsSet = false;
boolean mMediaPlayerIsPrepared = false;
public void onPrepared(MediaPlayer mediaplayer) {
Log.d(TAG, "onPrepared called");
mMediaPlayerIsPrepared = true;
if (mVideoSizeIsSet) {
mMediaPlayer.seekTo();
}
mMediaPlayer.start()
}
public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
Log.d(TAG, "onVideoSizeChanged called");
if (width == 0 || height == 0) {
Log.d(TAG, "invalid video width(" + width + ") or height(" + height + ")");
} else {
mVideoSizeIsSet = true;
if (mMediaPlayerIsPrepared) {
mMediaPlayer.seekTo();
}
}
}
( , , sdk, - ).
/ . 4.2. mMediaPlayer.start(), -, seekTo(), , . , onSeekComplete(), .
- , , .