Flutter video_player multiple videos

Viewed 2640

Flutter video_player package has this bug, when you play 4-5 videos, after that it hangs, does not play any more videos. Looks like in the backed its not releasing the controller and I see messages in Android Studio like, "Failed to initialize decoder: OMX.qcom.video.decoder.avc"

I am using the same controller and loading new video files from assets.

2 Answers

Try to use _controller.dispose(), when moving on to the next video. And make sure to use the same video controller.

Here is an example.

Solution:

final String url = 'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4';

VideoPlayerController.network(url, videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true));
Related