NativePlayer class

NativePlayer

Native based implementation of PlatformPlayer.

Inheritance

Constructors

NativePlayer({required PlayerConfiguration configuration})
NativePlayer

Properties

audioBitrateController StreamController<double?>
finalinherited
audioDeviceController StreamController<AudioDevice>
finalinherited
audioDevicesController StreamController<List<AudioDevice>>
finalinherited
audioParamsController StreamController<AudioParams>
finalinherited
bufferController StreamController<Duration>
finalinherited
bufferingController StreamController<bool>
finalinherited
completedController StreamController<bool>
finalinherited
completer Completer<void>
Completer to wait for initialization of this instance.
finalinherited
configuration PlayerConfiguration
User defined configuration for Player.
finalinherited
ctx Pointer<mpv_handle>
Pointer to generated.mpv_handle of this instance.
getter/setter pair
current HashSet<Media>
Currently loaded Medias. This is used to prevent additional data stored in Media from being garbage collected.
final
disposed bool
Whether the Player has been disposed. This is used to prevent accessing dangling ctx after dispose.
getter/setter pair
durationController StreamController<Duration>
finalinherited
errorController StreamController<String>
finalinherited
future Future<void>?
The Future to wait for _create completion. This is used to prevent signaling completer (from PlatformPlayer) before _create completes in any hypothetical situation (because idle-active may fire before it).
getter/setter pair
handle Future<int>
Internal platform specific identifier for this Player instance.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
heightController StreamController<int?>
finalinherited
isBufferingStateChangeAllowed bool
A flag to prevent changes to state.buffering due to pause causing core-idle to be true.
getter/setter pair
isPlayingStateChangeAllowed bool
A flag to prevent changes to state.playing due to loadfile commands in open.
getter/setter pair
isShuffleEnabled bool
A flag to keep track of setShuffle calls.
getter/setter pair
isVideoControllerAttached bool
bool for signaling VideoController (from package:media_kit_video) initialization.
getter/setter pairinherited
logController StreamController<PlayerLog>
finalinherited
mpv → MPV
Internal generated libmpv C API bindings.
final
pitchController StreamController<double>
finalinherited
playingController StreamController<bool>
finalinherited
playlistController StreamController<Playlist>
finalinherited
playlistModeController StreamController<PlaylistMode>
finalinherited
positionController StreamController<Duration>
finalinherited
rateController StreamController<double>
finalinherited
release List<Future<void> Function()>
Publicly defined clean-up Functions which must be called before dispose.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state PlayerState
Current state of the player.
getter/setter pairinherited
stream PlayerStream
Current state of the player available as listenable Streams.
getter/setter pairinherited
subtitleController StreamController<List<String>>
finalinherited
trackController StreamController<Track>
finalinherited
tracksController StreamController<Tracks>
finalinherited
videoControllerCompleter Completer<void>
Completer for signaling VideoController (from package:media_kit_video) initialization.
finalinherited
videoParamsController StreamController<VideoParams>
finalinherited
volumeController StreamController<double>
finalinherited
waitForPlayerInitialization Future<void>
Future<void> to wait for initialization of this instance.
no setterinherited
waitForVideoControllerInitializationIfAttached Future<void>
Future<void> to wait for VideoController (from package:media_kit_video) initialization.
no setterinherited
widthController StreamController<int?>
finalinherited

Methods

add(Media media, {bool synchronized = true}) Future<void>
Appends a Media to the Player's playlist.
override
dispose({bool synchronized = true}) Future<void>
Disposes the Player instance & releases the resources.
override
jump(int index, {bool synchronized = true}) Future<void>
Jumps to specified Media's index in the Player's playlist.
override
move(int from, int to, {bool synchronized = true}) Future<void>
Moves the playlist Media at from, so that it takes the place of the Media to.
override
next({bool synchronized = true}) Future<void>
Jumps to next Media in the Player's playlist.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open(Playable playable, {bool play = true, bool synchronized = true}) Future<void>
Opens a Media or Playlist into the Player. Passing play as true starts the playback immediately.
override
pause({bool synchronized = true}) Future<void>
Pauses the Player.
override
play({bool synchronized = true}) Future<void>
Starts playing the Player.
override
playOrPause({bool notify = true, bool synchronized = true}) Future<void>
Cycles between play & pause states of the Player.
override
previous({bool synchronized = true}) Future<void>
Jumps to previous Media in the Player's playlist.
override
remove(int index, {bool synchronized = true}) Future<void>
Removes the Media at specified index from the Player's playlist.
override
screenshot({String? format = 'image/jpeg', bool synchronized = true}) Future<Uint8List?>
Takes the snapshot of the current video frame & returns encoded image bytes as Uint8List.
override
seek(Duration duration, {bool synchronized = true}) Future<void>
Seeks the currently playing Media in the Player by specified Duration.
override
setAudioDevice(AudioDevice audioDevice, {bool synchronized = true}) Future<void>
Sets the current AudioDevice for audio output.
override
setAudioTrack(AudioTrack track, {bool synchronized = true}) Future<void>
Sets the current AudioTrack for audio output.
override
setPitch(double pitch, {bool synchronized = true}) Future<void>
Sets the relative pitch of the Player. Defaults to 1.0.
override
setPlaylistMode(PlaylistMode playlistMode, {bool synchronized = true}) Future<void>
Sets playlist mode.
override
setProperty(String property, String value) Future<void>
Sets property for the internal libmpv instance of this Player. Please use this method only if you know what you are doing, existing methods in Player implementation are suited for the most use cases.
setRate(double rate, {bool synchronized = true}) Future<void>
Sets the playback rate of the Player. Defaults to 1.0.
override
setShuffle(bool shuffle, {bool synchronized = true}) Future<void>
Enables or disables shuffle for Player. Default is false.
override
setSubtitleTrack(SubtitleTrack track, {bool synchronized = true}) Future<void>
Sets the current SubtitleTrack for subtitle output.
override
setVideoTrack(VideoTrack track, {bool synchronized = true}) Future<void>
Sets the current VideoTrack for video output.
override
setVolume(double volume, {bool synchronized = true}) Future<void>
Sets the playback volume of the Player. Defaults to 100.0.
override
stop({bool synchronized = true}) Future<void>
Stops the Player. Unloads the current Media or Playlist from the Player. This method is similar to dispose but does not release the resources & Player is still usable.
override
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

audioBitrateCache HashMap<String, double>
HashMap for retrieving previously fetched audio-bitrate(s).
final
lock → Lock
Synchronization & mutual exclusion between methods of this class.
final
test bool
Whether the NativePlayer is initialized for unit-testing.
getter/setter pair