jhomlala / betterplayer

Better video player for Flutter, with multiple configuration options. Solving typical use cases!
Apache License 2.0
923 stars 1k forks source link

[FEATURE] Expose the eventListeners within the better_player_controller.dart file #584

Closed Letalus closed 3 years ago

Letalus commented 3 years ago

Feature: Exposes all active eventListeners within the better_player_controller.dart file

Argument: This functionality is useful when user are working with recycleController (controllers which will be reused after they have been disposed, or after the video has changed). A good use case is if the user has a list of 100 videos within a pageviewer, creates 3 videoplayer, which then will be used to show all 100 videos (the pageviewer is always preloading the video before and after the current video). This approach avoids within android the OOM Bug (because in android you can only create around 3 video player instances and after that the system won't let you create more) Within iOS it is the same, except that you are able to create exactly 32 instances of the avplayer.

Conclusion: By exposing the eventListeners, the developers are enabled to recycle the videos more efficiently

Letalus commented 3 years ago

pull request for feature is within #585

jhomlala commented 3 years ago

@Letalus I don't see any connection with exposing event listeners from BetterPlayerController and limits of Android ExoPlayer/iOS AVPlayer instances. Please elaborate it.

Letalus commented 3 years ago

hmm I guess I worded it badly. Due to the fact that I need to recycle the controllers, remove all the listeners and after the controller and its listeners have been recycled, initialize it again and add a new listener to it, I need to be able to tell if there are currently active listeners. By exposing the eventListeners, I'm able to do exactly that

jhomlala commented 3 years ago

Okay, this will be included in next release.

jhomlala commented 3 years ago

Added in 0.0.71.