Player class
Loads, controls and renders audio and video content represented through Sources.
The player emits events during its lifecycle. See PlayerEventHandler
on
how to subscribe to events. Events are divided into player events and
source events, depending on if they are specific to the player or a source.
By default, a player instance does not provide any UI components. To use the default Bitmovin Player Web UI, a player instance can be attached to a PlayerView.
- Implemented types
Constructors
- Player({PlayerConfig config = const PlayerConfig()})
Properties
- analytics → AnalyticsApi
-
Provides access to Analytics related functionality.
no setter
-
availableSubtitles
→ Future<
List< SubtitleTrack> > -
A list of all available SubtitleTracks of the active Source,
including "off" subtitle track.
no setter
- config → PlayerConfig
-
The player config.
no setter
-
currentTime
→ Future<
double> -
The current playback time of the active Source in seconds.
For VoD streams the returned time ranges between 0 and the duration of
the asset. For live streams, a Unix timestamp denoting the current
playback position is returned.
no setter
-
duration
→ Future<
double> -
The duration of the active Source in seconds. Will be double.infinity
for live streams.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Unique identifier for this player instance.
no setter
-
isAirPlayActive
→ Future<
bool> -
Returns
true
when media is played externally using AirPlay.no setter -
isAirPlayAvailable
→ Future<
bool> -
Returns
true
when AirPlay is available.no setter -
isCastAvailable
→ Future<
bool> -
Whether casting to a cast-compatible remote device is available.
CastAvailableEvent signals when casting becomes available.
no setter
-
isCasting
→ Future<
bool> -
Whether video is currently being casted to a remote device and not played
locally.
no setter
-
isLive
→ Future<
bool> -
Whether the currently active Source is a live stream.
no setter
-
isMuted
→ Future<
bool> -
Whether the player is muted.
no setter
-
isPaused
→ Future<
bool> -
Whether the player is currently paused, i.e. has started playback but is
currently paused.
no setter
-
isPlaying
→ Future<
bool> -
Whether the player is currently playing, i.e. has started playback and is
not paused.
no setter
-
maxTimeShift
→ Future<
double> -
Returns the limit in seconds for time shifting. Is either negative or 0.
Only applicable for live streams.
no setter
- onAirPlayAvailable ← void Function(AirPlayAvailableEvent)
-
See AirPlayAvailableEvent for details on this event.
no getterinherited
- onAirPlayChanged ← void Function(AirPlayChangedEvent)
-
See AirPlayChangedEvent for details on this event.
no getterinherited
- onCastAvailable ← void Function(CastAvailableEvent)
-
See CastAvailableEvent for details on this event.
no getterinherited
- onCastStart ← void Function(CastStartEvent)
-
See CastStartEvent for details on this event.
no getterinherited
- onCastStarted ← void Function(CastStartedEvent)
-
See CastStartedEvent for details on this event.
no getterinherited
- onCastStopped ← void Function(CastStoppedEvent)
-
See CastStoppedEvent for details on this event.
no getterinherited
- onCastTimeUpdated ← void Function(CastTimeUpdatedEvent)
-
See CastTimeUpdatedEvent for details on this event.
no getterinherited
- onCastWaitingForDevice ← void Function(CastWaitingForDeviceEvent)
-
See CastWaitingForDeviceEvent for details on this event.
no getterinherited
- onCueEnter ← void Function(CueEnterEvent)
-
See CueEnterEvent for details on this event.
no getterinherited
- onCueExit ← void Function(CueExitEvent)
-
See CueExitEvent for details on this event.
no getterinherited
- onError ← void Function(ErrorEvent)
-
See ErrorEvent for details on this event.
no getterinherited
- onEvent ← void Function(Event)
-
Receives any event that is emitted by the player.
no getterinherited
- onInfo ← void Function(InfoEvent)
-
See InfoEvent for details on this event.
no getterinherited
- onMuted ← void Function(MutedEvent)
-
See MutedEvent for details on this event.
no getterinherited
- onPaused ← void Function(PausedEvent)
-
See PausedEvent for details on this event.
no getterinherited
- onPlay ← void Function(PlayEvent)
-
See PlayEvent for details on this event.
no getterinherited
- onPlaybackFinished ← void Function(PlaybackFinishedEvent)
-
See PlaybackFinishedEvent for details on this event.
no getterinherited
- onPlaying ← void Function(PlayingEvent)
-
See PlayingEvent for details on this event.
no getterinherited
- onReady ← void Function(ReadyEvent)
-
See ReadyEvent for details on this event.
no getterinherited
- onSeek ← void Function(SeekEvent)
-
See SeekEvent for details on this event.
no getterinherited
- onSeeked ← void Function(SeekedEvent)
-
See SeekedEvent for details on this event.
no getterinherited
- onSourceAdded ← void Function(SourceAddedEvent)
-
See SourceAddedEvent for details on this event.
no getterinherited
- onSourceError ← void Function(SourceErrorEvent)
-
See SourceErrorEvent for details on this event.
no getterinherited
- onSourceInfo ← void Function(SourceInfoEvent)
-
See SourceInfoEvent for details on this event.
no getterinherited
- onSourceLoad ← void Function(SourceLoadEvent)
-
See SourceLoadEvent for details on this event.
no getterinherited
- onSourceLoaded ← void Function(SourceLoadedEvent)
-
See SourceLoadedEvent for details on this event.
no getterinherited
- onSourceRemoved ← void Function(SourceRemovedEvent)
-
See SourceRemovedEvent for details on this event.
no getterinherited
- onSourceUnloaded ← void Function(SourceUnloadedEvent)
-
See SourceUnloadedEvent for details on this event.
no getterinherited
- onSourceWarning ← void Function(SourceWarningEvent)
-
See SourceWarningEvent for details on this event.
no getterinherited
- onSubtitleAdded ← void Function(SubtitleAddedEvent)
-
See SubtitleAddedEvent for details on this event.
no getterinherited
- onSubtitleChanged ← void Function(SubtitleChangedEvent)
-
See SubtitleChangedEvent for details on this event.
no getterinherited
- onSubtitleRemoved ← void Function(SubtitleRemovedEvent)
-
See SubtitleRemovedEvent for details on this event.
no getterinherited
- onTimeChanged ← void Function(TimeChangedEvent)
-
See TimeChangedEvent for details on this event.
no getterinherited
- onTimeShift ← void Function(TimeShiftEvent)
-
See TimeShiftEvent for details on this event.
no getterinherited
- onTimeShifted ← void Function(TimeShiftedEvent)
-
See TimeShiftedEvent for details on this event.
no getterinherited
- onUnmuted ← void Function(UnmutedEvent)
-
See UnmutedEvent for details on this event.
no getterinherited
- onWarning ← void Function(WarningEvent)
-
See WarningEvent for details on this event.
no getterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
subtitle
→ Future<
SubtitleTrack> -
The currently selected
SubtitleTrack
.no setter -
timeShift
→ Future<
double> -
Returns the the current time shift value of the player in seconds. It
describes the offset from the live edge. The returned value is within
maxTimeShift (which is a negative value) and 0 (the live edge).
Only applicable for live streams.
no setter
Methods
-
castStop(
) → Future< void> - Stops casting the current video.
-
castVideo(
) → Future< void> - Initiates casting the current video to a cast-compatible remote device. The user has to choose to which device it should be sent.
-
dispose(
) → Future< void> - Dispose the player instance when no longer needed.
-
emitEvent(
Event event) → void -
Takes an Event and emits it to the corresponding event listener.
inherited
-
loadSource(
Source source) → Future< void> - Starts a new playback session with the provided Source.
-
loadSourceConfig(
SourceConfig sourceConfig) → Future< void> - Starts a new playback session with a Source that is created based on the provided SourceConfig.
-
mute(
) → Future< void> - Mutes the player.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pause(
) → Future< void> - Pauses playback.
-
play(
) → Future< void> - Starts or resumes playback.
-
removeSubtitle(
String id) → Future< void> -
Removes the existing SubtitleTrack specified by
id
. If the track is currently active, it will be deactivated and then removed. If no SubtitleTrack with the givenid
exists, the call will be ignored. Using this API removes the SubtitleTrack from the availableSubtitles, use setSubtitle to disable an active SubtitleTrack. -
seek(
double time) → Future< void> - Seeks to the given playback time in seconds. Must not be greater than the duration of the active Source. Only applicable for VOD. For live streams, use timeShift and setTimeShift.
-
setSubtitle(
String? id) → Future< void> -
Sets the currently selected SubtitleTrack based on the provided
id
. Usingnull
asid
disables subtitles. A list of currently available SubtitleTracks can be retrieved via availableSubtitles. -
setTimeShift(
double timeShift) → Future< void> - Shifts the playback time to the given offset in seconds from the live edge. Has to be within maxTimeShift (which is a negative value) and 0. The offset can be positive and is then interpreted as a UNIX timestamp in seconds. The value has to be within the time shift window, as specified by maxTimeShift. Only applicable for live streams. For VOD, use seek.
-
showAirPlayTargetPicker(
) → Future< void> - Shows the AirPlay playback target picker.
-
toString(
) → String -
A string representation of this object.
inherited
-
unmute(
) → Future< void> - Unmutes the player.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited