PipFlutterPlayerController class

Class used to control overall PipFlutter Player behavior. Main class to change state of PipFlutter Player.

Constructors

PipFlutterPlayerController(PipFlutterPlayerConfiguration pipFlutterPlayerConfiguration, {PipFlutterPlayerPlaylistConfiguration? pipFlutterPlayerPlaylistConfiguration, PipFlutterPlayerDataSource? pipFlutterPlayerDataSource})

Properties

controllerEventStream Stream<PipFlutterPlayerControllerEvent>
Stream of internal controller events. Shouldn't be used inside app. For normal events, use eventListener.
no setter
controlsAlwaysVisible bool
Are controls always visible
no setter
controlsEnabled bool
Flag which determines if controls (UI interface) is shown. When false, UI won't be shown (show only player surface).
no setter
controlsVisibilityStream Stream<bool>
Stream which sends flag whenever visibility of controls changes
no setter
eventListener → dynamic Function(PipFlutterPlayerEvent)?
Defines a event listener where video player events will be send.
no setter
eventListeners List<dynamic Function(PipFlutterPlayerEvent)?>
Expose all active eventListeners
no setter
hasCurrentDataSourceStarted bool
Flag which determines whenever current data source has started.
no setter
hashCode int
The hash code for this object.
no setterinherited
isFullScreen bool
Flag used to store full screen mode state.
no setter
nextVideoTimeStream Stream<int?>
no setter
pipFlutterPlayerAsmsAudioTrack PipFlutterPlayerAsmsAudioTrack?
Selected ASMS audio track
no setter
pipFlutterPlayerAsmsAudioTracks List<PipFlutterPlayerAsmsAudioTrack>?
List of all possible audio tracks returned from ASMS stream
no setter
pipFlutterPlayerAsmsTrack PipFlutterPlayerAsmsTrack?
Currently selected player track. Used only for HLS / DASH.
no setter
pipFlutterPlayerAsmsTracks List<PipFlutterPlayerAsmsTrack>
List of tracks available for current data source. Used only for HLS / DASH.
no setter
pipFlutterPlayerConfiguration PipFlutterPlayerConfiguration
General configuration used in controller instance.
final
pipFlutterPlayerDataSource PipFlutterPlayerDataSource?
Currently used data source in player.
no setter
pipFlutterPlayerGlobalKey GlobalKey<State<StatefulWidget>>?
Getter of the GlobalKey
no setter
pipFlutterPlayerPlaylistConfiguration PipFlutterPlayerPlaylistConfiguration?
Playlist configuration used in controller instance.
final
pipFlutterPlayerSubtitlesSource PipFlutterPlayerSubtitlesSource?
Currently used subtitles source.
no setter
pipFlutterPlayerSubtitlesSourceList List<PipFlutterPlayerSubtitlesSource>
List of PipFlutterPlayerSubtitlesSources.
no setter
renderedSubtitle PipFlutterPlayerSubtitle?
Currently displayed PipFlutterPlayerSubtitle.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subtitlesLines List<PipFlutterPlayerSubtitle>
Subtitles lines for current data source.
getter/setter pair
translations PipFlutterPlayerTranslations
Currently used translations
getter/setter pair
videoPlayerController VideoPlayerController?
Instance of video player controller which is adapter used to communicate between flutter high level code and lower level native code.
getter/setter pair

Methods

addEventsListener(dynamic eventListener(PipFlutterPlayerEvent)) → void
Add event listener which listens to player events.
cancelNextVideoTimer() → void
Cancel next video timer. Used in playlist. Do not use manually.
clearCache() Future<void>
Clear all cached data. Video player controller must be initialized to clear the cache.
disablePictureInPicture() Future<void>?
Disable Picture in Picture mode if it's enabled.
dispose({bool forceDispose = false}) → void
Dispose PipFlutterPlayerController. 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>> pipFlutterPlayerGlobalKey) Future<void>?
Enable Picture in Picture (PiP) mode. pipFlutterPlayerGlobalKey is required to open PiP mode in iOS. When device is not supported, PiP mode won't be open.
enterFullScreen() → void
Enables full screen mode in player. This will trigger route change.
exitFullScreen() → void
Disables full screen mode in player. This will trigger route change.
getAspectRatio() double?
Get aspect ratio used in current video. If aspect ratio is null, then aspect ratio from PipFlutterPlayerConfiguration will be used. Otherwise _overriddenAspectRatio will be used.
isBuffering() bool?
Flag which determines whenever player is loading video data or not.
isLiveStream() bool
Flag which determines whenever player is playing live data source.
isPictureInPictureSupported() Future<bool>
Check if picture in picture mode is supported in this device.
isPlaying() bool?
Flag which determines whenever player is playing or not.
isVideoInitialized() bool?
Flag which determines whenever player data source has been initialized.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onPlayerVisibilityChanged(double visibilityFraction) → void
Listener which handles state of player visibility. If player visibility is below 0.0 then video will be paused. When value is greater than 0, video will play again. If there's different handler of visibility then it will be used. If showNotification is set in data source or handleLifecycle is false then this logic will be ignored.
pause() Future<void>
Stop video playback.
play() Future<void>
Start video playback. Play will be triggered only if current lifecycle state is resumed.
playNextVideo() → void
Play next video form playlist. Do not use manually.
postEvent(PipFlutterPlayerEvent pipFlutterPlayerEvent) → void
Send player event. Shouldn't be used manually.
preCache(PipFlutterPlayerDataSource pipFlutterPlayerDataSource) Future<void>
PreCache a video. On Android, the future succeeds when the requested size, specified in PipFlutterPlayerCacheConfiguration.preCacheSize, is downloaded or when the complete file is downloaded if the file is smaller than the requested size. On iOS, the whole file will be downloaded, since maxCacheFileSize is currently not supported on iOS. On iOS, the video format must be in this list: https://github.com/sendyhalim/Swime/blob/master/Sources/MimeType.swift
removeEventsListener(dynamic eventListener(PipFlutterPlayerEvent)) → void
Remove event listener. This method should be called once you're disposing PipFlutter Player.
retryDataSource() Future
Retry data source if playback failed.
seekTo(Duration moment) Future<void>
Move player to specific position/moment of the video.
setAppLifecycleState(AppLifecycleState appLifecycleState) → void
Set current lifecycle state. If state is AppLifecycleState.resumed then player starts playing again. if lifecycle is in AppLifecycleState.paused state, then video playback will stop. If showNotification is set in data source or handleLifecycle is false then this logic will be ignored.
setAudioTrack(PipFlutterPlayerAsmsAudioTrack audioTrack) → void
Set audioTrack in player. Works only for HLS or DASH streams.
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>
Enables/disables looping (infinity playback) mode.
setMixWithOthers(bool mixWithOthers) → void
Enable or disable audio mixing with other sound within device.
setOverriddenAspectRatio(double aspectRatio) → void
Setup overridden aspect ratio.
setPipFlutterPlayerGlobalKey(GlobalKey<State<StatefulWidget>> pipFlutterPlayerGlobalKey) → void
Set GlobalKey of PipFlutterPlayer. Used in PiP methods called from controls.
setResolution(String url) → void
Set different resolution (quality) for video
setSpeed(double speed) Future<void>
Set playback speed of video. Allows to set speed value between 0 and 2.
setTrack(PipFlutterPlayerAsmsTrack track) → void
Setup track parameters for currently played video. Can be only used for HLS or DASH data source.
setupDataSource(PipFlutterPlayerDataSource pipFlutterPlayerDataSource) Future
Setup new data source in PipFlutter Player.
setupSubtitleSource(PipFlutterPlayerSubtitlesSource subtitlesSource, {bool sourceInitialize = false}) Future<void>
Setup subtitles to be displayed from given subtitle source. If subtitles source is segmented then don't load videos at start. Videos will load with just in time policy.
setupTranslations(Locale locale) → void
Setup translations for given locale. In normal use cases it shouldn't be called manually.
setVolume(double volume) Future<void>
Set volume of player. Allows values from 0.0 to 1.0.
startNextVideoTimer() → void
Start timer which will trigger next video. Used in playlist. Do not use manually.
stopPreCache(PipFlutterPlayerDataSource pipFlutterPlayerDataSource) Future<void>
Stop pre cache for given pipFlutterPlayerDataSource. If there was no pre cache started for given pipFlutterPlayerDataSource then it will be ignored.
toggleControlsVisibility(bool isVisible) → void
Internal method, used to trigger CONTROLS_VISIBLE or CONTROLS_HIDDEN event once controls state changed.
toggleFullScreen() → void
Enables/disables full screen mode based on current fullscreen state.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

of(BuildContext context) PipFlutterPlayerController
Get PipFlutterPlayerController from context. Used in InheritedWidget.