Search code examples
androidvideocontrolsandroid-videoview

Rotating phone restarts video on android


When I rotate my phone, my Activity restarts. I have a video view playing video, I rotate and the video restarts. Now I found adding this to my activity in the manifest fixed it

<activity android:name="Vforum" android:configChanges="orientation"></activity>

The problem now is the video controls aren't being redrawn until they disappear and come back, thus leaving either really long controls going from landscape to portrait mode or really short controls going from portrait to landscape. Once they disappear and then I tap to make them come back, then they are correctly sized. Is there a better method of doing this?


Solution

  • add

    android:configChanges="orientation"

    to your Activity in AndroidManifest.xml.

    • solved my issue won't download progressive video again..

    If your target API level 13 or higher, you must include the screenSize value in addition to the orientation value as described here. So your tag may look like

    android:configChanges="orientation|screenSize"