Exoplayer video Transition from one activity to other without stopping plaback

1.2k views Asked by At

Does anybody have any suggestions to how to achieve this scenario with exoplayer or somple media player. I have requirements like a video is playing on a list and on click on that video it should be move to New full screen activity with smooth transition and without playback stop.

Please comment if you have any working code or any suggestions. Thanks

1

There are 1 answers

0
Sermilion On

This is not easily done. Basically, you have your SimpleExoPlayer, which loads the video and plays it and you have your view that the video is displayed on, for example TextureView.

The key here is not to create a new player object, but to share the player between the screens you transitioning between. What you have to do is detach the player from your view, access the player in another screen and attach it to the view on your second screen.

The player reference management is not the easiest in. this case. A simple way will be to use a map that will store all of your initialized players and you would be able to access the player you need by the key, which can be your video URL.

When transitioning to another screen DO NOT RELEASE your player, ONLY DETACH from current view. Don't pause the video and do not do player.seekTo(), your player will not loose its state.

And dont ask for code or really angry and serious people will downvote you.