3

我使用 videoview 在 android 默认播放器中播放视频。当我改变它的方向时,它会从头开始播放。

我怎样才能让它从那一点继续,方向改变了?

4

2 回答 2

15

Add:

<activity
    android:name="...your_activity..."
    android:configChanges="screenSize|orientation|keyboardHidden"
/>

to the AndroidManifest file, to the Activity that handles video play back.

于 2012-07-24T11:15:32.883 回答
4

When you change the orientation the OS destroys your activity, and recreates it.

You can save the actual progress of the video in onSaveInstanceState() and get the saved data in onRestoreInstanceState() from the Bundle, after that you can start the playing with either the progress data, or from the beginning if there was no data saved.

于 2012-07-24T11:14:46.873 回答