Folks,
I have created an application to play video using MediaCodec and MediaExtractor classes. This application is based on the sample from https://vec.io/posts/android-hardware-decoding-with-mediacodec.
The video seems to play fine. However, as soon as the orientation changes, the video starts from the beginning. This is because the activity gets recreated and the background thread, the extractor and the decoder are all instantiated once again.
For my needs, I cannot disable the orientation.
I have looked at other messages related to MediaCodec but couldn't find how developers are dealing with screen orientation (except for disabling orientation which is not an option for me).
One thought I had was to persist the seek position of the extractor during activity destruction. This way, on activity recreation, I could just seek to the right position. However, I couldn't find any method on the extractor to return the seek position (although there is a method to seek to a location).
I am wondering if someone can enlighten me on how I could achieve continuous video playback on screen orientation.
Thank you in advance for your help.
Regards,
Peter