BetterPlayerController class


BetterPlayerController(BetterPlayerConfiguration betterPlayerConfiguration, {BetterPlayerPlaylistConfiguration betterPlayerPlaylistConfiguration, BetterPlayerDataSource betterPlayerDataSource})


autoPlay → bool
betterPlayerConfiguration BetterPlayerConfiguration
betterPlayerDataSource BetterPlayerDataSource
betterPlayerGlobalKey → GlobalKey<State<StatefulWidget>>
Getter of the GlobalKey
betterPlayerPlaylistConfiguration BetterPlayerPlaylistConfiguration
betterPlayerSubtitlesSource BetterPlayerSubtitlesSource
betterPlayerSubtitlesSourceList → List<BetterPlayerSubtitlesSource>
betterPlayerTrack → BetterPlayerHlsTrack
betterPlayerTracks → List<BetterPlayerHlsTrack>
cancelFullScreenDismiss ↔ bool
Internal flag used to cancel dismiss of the full screen. Used when user switches quality (track or resolution) of the video. You should ignore it.
read / write
controlsAlwaysVisible → bool
controlsEnabled → bool
Flag which determines if controls (UI interface) is shown. When false, UI won't be shown (show only player surface).
controlsVisibilityStream → Stream<bool>
Stream which sends flag whenever visibility of controls changes
errorBuilder → Widget Function(BuildContext context, String errorMessage)
eventListener → dynamic Function(BetterPlayerEvent)
Defines a event listener where video player events will be send
hasCurrentDataSourceStarted → bool
hashCode → int
The hash code for this object. [...]
read-only, inherited
hasListeners → bool
Whether any listeners are currently registered. [...]
@protected, read-only, inherited
isFullScreen → bool
nextVideoTimeStreamController ↔ StreamController<int>
read / write
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited
subtitlesLines ↔ List<BetterPlayerSubtitle>
read / write
translations BetterPlayerTranslations
Currently used translations
read / write
videoPlayerController ↔ VideoPlayerController
read / write


addEventsListener(dynamic eventListener(BetterPlayerEvent)) → void
addListener(VoidCallback listener) → void
Register a closure to be called when the object changes. [...]
cancelNextVideoTimer() → void
disablePictureInPicture() → Future<void>
Disable Picture in Picture mode if it's enabled.
dispose({bool forceDispose = false}) → void
Dispose BetterPlayerController. When forceDispose parameter is true, then autoDispose parameter will be overridden and controller will be disposed (if it wasn't disposed before).
enablePictureInPicture(GlobalKey<State<StatefulWidget>> betterPlayerGlobalKey) → Future<void>
Enable Picture in Picture (PiP) mode. betterPlayerGlobalKey is required to open PiP mode in iOS. When device is not supported, PiP mode won't be open.
enterFullScreen() → void
exitFullScreen() → void
getAspectRatio() → double
Get aspect ratio used in current video. If aspect ratio is null, then aspect ratio from BetterPlayerConfiguration will be used. Otherwise _overriddenAspectRatio will be used.
isBuffering() → bool
isLiveStream() → bool
isPictureInPictureSupported() → Future<bool>
Check if picture in picture mode is supported in this device.
isPlaying() → bool
isVideoInitialized() → bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
notifyListeners() → void
Call all the registered listeners. [...]
@protected, @visibleForTesting, inherited
onPlayerVisibilityChanged(double visibilityFraction) → void
pause() → Future<void>
play() → Future<void>
playNextVideo() → void
removeEventsListener(dynamic eventListener(BetterPlayerEvent)) → void
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes. [...]
seekTo(Duration moment) → Future<void>
setAppLifecycleState(AppLifecycleState appLifecycleState) → void
setBetterPlayerGlobalKey(GlobalKey<State<StatefulWidget>> betterPlayerGlobalKey) → void
Set GlobalKey of BetterPlayer. Used in PiP methods called from controls.
setControlsAlwaysVisible(bool controlsAlwaysVisible) → void
Setup controls always visible mode
setControlsEnabled(bool enabled) → void
Enable/disable controls (when enabled = false, controls will be always hidden)
setControlsVisibility(bool isVisible) → void
Show or hide controls manually
setLooping(bool looping) → Future<void>
setOverriddenAspectRatio(double aspectRatio) → void
Setup overridden aspect ratio.
setResolution(String url) → void
Set different resolution (quality) for video
setSpeed(double speed) → Future<void>
setTrack(BetterPlayerHlsTrack track) → void
Setup track parameters for currently played video
setupDataSource(BetterPlayerDataSource betterPlayerDataSource) → Future
setupSubtitleSource(BetterPlayerSubtitlesSource subtitlesSource) → Future<void>
Setup subtitles to be displayed from given subtitle source
setupTranslations(Locale locale) → void
Setup translations for given locale. In normal use cases it shouldn't be called manually.
setVolume(double volume) → Future<void>
startNextVideoTimer() → void
toggleControlsVisibility(bool isVisible) → void
Internal method, used to trigger CONTROLS_VISIBLE or CONTROLS_HIDDEN event once controls state changed.
toggleFullScreen() → void
toString() → String
Returns a string representation of this object.


operator ==(Object other) → bool
The equality operator. [...]

Static Methods

of(BuildContext context) BetterPlayerController