muslimtv / flutter_playout

AV Playout in Flutter
BSD 3-Clause "New" or "Revised" License
154 stars 93 forks source link

How to get the call back before and after player gets initialized #78

Open wilz05 opened 3 years ago

wilz05 commented 3 years ago

Thank you for you're effort, this package works really great on m3u8 links

Am looking for solution like whenever the player gets loaded or being initialized Need to show CircularProgressIndicator or some loading animations, how can we do it ? like for example....

return Video(
              autoPlay: false,
              loadingPlaceholder: Center(
      child: CircularProgressIndicator()),
..........
);

or like if the player is null show progressindicators

_videoController != null &&
                _videoController!.value.isInitialized ? CircularProgressIndicator()  : Video(
controller=_videoController
........
)
KhuramKhalid commented 3 years ago

You can use the onPlay through PlayerObserver to get notified when video starts playing. You can then hide the loading indicator. Checkout the example for this.

wilz05 commented 3 years ago

In my case there will be 5-6 streaming players in one screen, so my default desiredState = PlayerState.Stopped

wilz05 commented 3 years ago

@KhuramKhalid Can I use the above onPlay through PlayerObserver method and to resolve it ? when the state is Stopped. or In future are there any chance to add the above callbacks/functionally?