MPVPlayer class
Methods
addAudioTrack (String file , AddMediaFlag ? flag , String ? title , String ? lang )
→ Future <void >
addProperty (dynamic property , dynamic value )
→ Future <void >
adds the value to the property
addSubtitles (String file , {AddMediaFlag ? flag , String ? title , String ? lang })
→ Future
add subtitle file
@param file
- path to the subtitle file
@param flag
- select / auto /cached
@param title
- subtitle title in the UI
@param lang
- subitlte language
adjustAudioTiming (int seconds )
→ Future <void >
adjusts the timing of the audio track
adjustSubtitleTiming (int seconds )
→ Future <void >
brightness (double value )
→ Future <void >
adjust the brightness
value between -100, 100
clear ()
→ void
Clear all subscribers from the cache.
inherited
clearPlaylist ()
→ Future
clears the playlist
command <T > (String command , List args )
→ Future <T >
send a command with arguments to mpv
commandJSON (Map command )
→ Future <void >
sends a command specified by a JSON object to mpv
contrast (double value )
→ Future <void >
adjust the contrast
value between -100, 100
cycleAudioTracks ()
→ Future <void >
cycles through the audio track
cycleProperty (dynamic property )
→ Future <void >
cycles a arbitrary property
cycleSubtitles ()
→ Future <void >
displayASS (dynamic ass , dynamic duration , {dynamic position = 7 })
→ Future <void >
emit (String event , [Object ? sender , Object ? data ])
→ void
API to emit events.
event is a required parameter.
If sender information is sent, it will be used to intimate user about it.
event
- What event needs to be emitted.
sender
- The sender who published the event. Ignore if not required.
data
- Data the event need to carry. Ignore this argument if no data needs to be sent.
inherited
freeCommand (String command )
→ Future <void >
send a freely writeable command to mpv
the required trailing \n will be added
fullscreen ()
→ Future <void >
gamma (dynamic value )
→ Future <void >
adjust the gamma value
value between -100, 100
getAlbum ()
→ Future
Returns the album title of the current song if available
getArtist ()
→ Future
Returns the artist of the current song if available
getDuration ()
→ Future <double >
Duration of the currently playing song if available
getFilename ({FileFormat format = FileFormat.full })
→ Future <String >
Returns the filename/url of the current track
getListenersCount (String event )
→ int
Get the list of subscribers for a particular event.
inherited
getMetadata ()
→ Future <Map >
Returns the available metadata for the current track. The output is
very dependant on the loaded file
getPercentPosition ()
→ Future <double >
Current time position (in percent) of the currently playing song
getPlaylistPosition ()
→ Future <int >
returns the current playlist position (as a promise) 0 based
getPlaylistPosition1 ()
→ Future <int >
getPlaylistSize ()
→ Future <int >
getProperty <T > (dynamic property )
→ Future <T >
will send a get request for the specified property
if no id
is provided this will return a promise
if an id
is provided the answer will come via a 'getrequest'
event containing the id
and data
getTimePosition ()
→ Future <double >
Current time position of the currently playing song
getTimeRemaining ()
→ Future <double >
Remaining time for the currently playing song, if available
getTitle ()
→ Future <String >
Title of the currently playing song. Might be unavailable
getYear ()
→ Future
Returns the year of the current song if available
goToPosition (double seconds )
→ Future <void >
go to position of the song
hideSubtitles ()
→ Future <void >
hue (dynamic value )
→ Future <void >
adjust the hue
value between -100, 100
isMuted ()
→ Future <bool >
Shows if the player is muted
isPaused ()
→ Future <bool >
Shows if the player is paused
isRunning ()
→ dynamic
Shows whether mpv is running or not
isSeekable ()
→ Future <bool >
Shows if the current title is seekable or not
Not fully buffered streams are not for example
jump (int position )
→ Future <bool >
jump to song in the playlist
leaveFullscreen ()
→ Future <void >
load (String source , {LoadMode mode = LoadMode.replace , List <String > options = const [] })
→ Future <void >
loads a file into mpv
loadPlaylist (String playlist , {LoadPlaylistMode mode = LoadPlaylistMode.replace })
→ Future <void >
load a playlist file
@param mode
->
LoadPlaylistMode.replace
replace current playlist
LoadPlaylistMode.append
append to current playist
loop (dynamic times )
→ Future <void >
loop
{int|String} times->
number n - loop n times
'inf' - loop infinitely often
'no' - switch loop to off
loopPlaylist (dynamic times )
→ dynamic
loop
@param times
{int|String} ->/
number n - loop n times
'inf' - loop infinitely often
'no' - switch loop to off
multiplyProperty (dynamic property , dynamic value )
→ Future <void >
multiplies the specified property by the value
mute (bool ? should )
→ Future <void >
mute
bool should
->
true
mutes
false
unmutes
Not setting set toggles the mute state
next ({PlaylistPositionChangeMode mode = PlaylistPositionChangeMode.weak })
→ Future <bool >
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
observeProperty <T > (String propertyKey )
→ Future <T >
observe a property for changes
will be added to event for property changes
off (Listener? listener )
→ void
Remove event listener from emitter.
This will unsubscribe the caller from the emitter from any future events.
Listener should be a valid instance.
listener
- Listener
instance to be removed from the event subscription.
inherited
on (String event , Object ? context , EventCallback callback )
→ Listener
API to register for notification.
It is mandatory to pass event name and callback parameters.
event
- Event name used for the subscription. A valid event name is mandatory.
context
- Context information, which need to be sent in all emitted events.
callback
- EventCallback
function registered to receive events emitted from the publisher. A valid callback function is mandatory.
inherited
pause ()
→ Future <void >
play ()
→ Future <void >
playlistMove (dynamic index1 , dynamic index2 )
→ Future
Moves the song/video on position index1 to position index2
playlistRemove (dynamic index )
→ Future
remove the song at index or the current song, if index = 'current'
prev ({PlaylistPositionChangeMode mode = PlaylistPositionChangeMode.weak })
→ Future <bool >
quit ()
→ Future <void >
Quits the MPV player
removeAllByCallback (EventCallback callback )
→ void
Remove all listeners which matches with the callback provided.
It is possible to register for multiple events with a single callback.
This mechanism ensure that all event registrations would be cancelled which matches the callback.
callback
- The event callback used during subscription.
inherited
removeAllByEvent (String event )
→ void
Use this mechanism to remove all subscription for a particular event.
Caution : This will remove all the listeners from multiple files or classes or modules.
Think twice before calling this API and make sure you know what you are doing!!!
event
- Event name used during subscription.
inherited
removeAudioTrack (String id )
→ Future <void >
delete the audio track specified by the id
removeListener (String eventName , EventCallback callback )
→ void
Unsubscribe from getting any future events from emitter.
This mechanism uses event name and callback to unsubscribe from all possible events.
eventName
- Event name for the subscription.
callback
- EventCallback
used when registering subscription using on function.
inherited
removeSubtitles (dynamic id )
→ Future
resume ()
→ Future <void >
rotateVideo (int degrees )
→ Future <void >
video rotate
degrees 90 / 180 / 270 / 360
absolute rotation
saturation (dynamic value )
→ Future <void >
adjust the saturation
value between -100, 100
screenshot (String file , {String ? option })
→ Future
takes a screenshot
@param option
->
subtitles - with subtitles
video - without subtitles
window - the scaled mpv window
seek (double seconds , {SeekMode mode = SeekMode.relative })
→ Future <void >
selectAudioTrack (String id )
→ Future <void >
selects the audio track
selectSubtitles (dynamic id )
→ Future <void >
setMultipleProperties (Map properties )
→ Future <void >
sets all properties defined in the properties Json object
setProperty (dynamic property , dynamic value )
→ Future <void >
set a property specified by the mpv API
showSubtitles ()
→ Future <void >
shuffle ()
→ Future
shuffle the playlist
speed (double factor )
→ Future <void >
adjust the playback speed
factor 0.01 - 100
start ({List <String > mpv_args = const [] })
→ Future <void >
Starts the MPV player process
stop ()
→ Future <void >
subtitleScale (double scale )
→ Future <void >
subtitleSeek (int lines )
→ Future
toggleFullscreen ()
→ Future <void >
togglePause ()
→ Future <void >
toggleSubtitleVisibility ()
→ Future <void >
toString ()
→ String
A string representation of this object.
inherited
unobserveProperty <T > (String propertyKey )
→ Future <T >
stop observing a property
unshuffle ()
→ Future
volume (double value )
→ Future <void >
volume control values 0-100
zoomVideo (int factor )
→ Future <void >
zooms into the image
0 is no zoom at all
1 is twice the size\