onInit method
Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.
Implementation
@override
void onInit() {
///It's use to fetch hls segment and subtitle.
fetchHlsMasterPlaylist =
FetchHlsMasterPlaylist(playerResource: playerResource);
///Method that use to interact with player on native code.
playerMethodManager = PlayerMethodManager(
fetchHlsMasterPlaylist: fetchHlsMasterPlaylist,
playWhenReady: playWhenReady);
///Method that use to open bottom sheet, i.e open bottom sheet to show quality, playback speed, download by quality.
playerMaterialBottomSheet = PlayerMaterialBottomSheet(
context: context,
fetchHlsMasterPlaylist: playerMethodManager.fetchHlsMasterPlaylist,
playerMethodManager: playerMethodManager);
///Called when player subtitle has changed, i.e user change from english to khmer.
_handleSubtitleEvent();
///Called when player state has changed, i.e. new player position, etc.
_handleDurationStateEvent();
///Called when download state has changed, i.e user start, pause, resume, failed download.
_handleDownloadEvent();
///Called when play back state has changed i.e player going to ready to play, pause, play, loading, and finish.
_handlePlaybackStateEvent();
///Called every 8 seconds to hide overlay controller.
handleControllerTimeout();
super.onInit();
}