我使用 videoview 在 android 默认播放器中播放视频。当我改变它的方向时,它会从头开始播放。
我怎样才能让它从那一点继续,方向改变了?
Add:
<activity
android:name="...your_activity..."
android:configChanges="screenSize|orientation|keyboardHidden"
/>
to the AndroidManifest file, to the Activity that handles video play back.
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.