pub trait MpvExt {
Show 34 methods
// Required methods
async fn seek(
&self,
seconds: f64,
option: SeekOptions,
) -> Result<(), MpvError>;
async fn playlist_shuffle(&self) -> Result<(), MpvError>;
async fn playlist_remove_id(&self, id: usize) -> Result<(), MpvError>;
async fn playlist_play_next(&self, id: usize) -> Result<(), MpvError>;
async fn playlist_play_id(&self, id: usize) -> Result<(), MpvError>;
async fn playlist_move_id(
&self,
from: usize,
to: usize,
) -> Result<(), MpvError>;
async fn playlist_clear(&self) -> Result<(), MpvError>;
async fn playlist_add(
&self,
file: &str,
file_type: PlaylistAddTypeOptions,
option: PlaylistAddOptions,
) -> Result<(), MpvError>;
async fn restart(&self) -> Result<(), MpvError>;
async fn prev(&self) -> Result<(), MpvError>;
async fn observe_property(
&self,
id: u64,
property: &str,
) -> Result<(), MpvError>;
async fn unobserve_property(&self, id: u64) -> Result<(), MpvError>;
async fn next(&self) -> Result<(), MpvError>;
async fn kill(&self) -> Result<(), MpvError>;
async fn stop(&self) -> Result<(), MpvError>;
async fn set_volume(
&self,
input_volume: f64,
option: NumberChangeOptions,
) -> Result<(), MpvError>;
async fn set_speed(
&self,
input_speed: f64,
option: NumberChangeOptions,
) -> Result<(), MpvError>;
async fn set_playback(&self, option: Switch) -> Result<(), MpvError>;
async fn set_mute(&self, option: Switch) -> Result<(), MpvError>;
async fn set_loop_playlist(&self, option: Switch) -> Result<(), MpvError>;
async fn set_loop_file(&self, option: Switch) -> Result<(), MpvError>;
async fn get_playlist(&self) -> Result<Playlist, MpvError>;
async fn get_metadata(
&self,
) -> Result<HashMap<String, MpvDataType>, MpvError>;
async fn get_file_path(&self) -> Result<String, MpvError>;
async fn get_volume(&self) -> Result<f64, MpvError>;
async fn get_speed(&self) -> Result<f64, MpvError>;
async fn get_time_pos(&self) -> Result<Option<f64>, MpvError>;
async fn get_time_remaining(&self) -> Result<Option<f64>, MpvError>;
async fn get_duration(&self) -> Result<f64, MpvError>;
async fn get_playlist_pos(&self) -> Result<usize, MpvError>;
async fn is_muted(&self) -> Result<bool, MpvError>;
async fn is_playing(&self) -> Result<bool, MpvError>;
async fn playlist_is_looping(&self) -> Result<LoopProperty, MpvError>;
async fn file_is_looping(&self) -> Result<LoopProperty, MpvError>;
}
Expand description
A set of typesafe high-level functions to interact with Mpv
.
Required Methods§
sourceasync fn seek(&self, seconds: f64, option: SeekOptions) -> Result<(), MpvError>
async fn seek(&self, seconds: f64, option: SeekOptions) -> Result<(), MpvError>
Seek to a specific position in the current video.
sourceasync fn playlist_shuffle(&self) -> Result<(), MpvError>
async fn playlist_shuffle(&self) -> Result<(), MpvError>
Shuffle the current playlist.
sourceasync fn playlist_remove_id(&self, id: usize) -> Result<(), MpvError>
async fn playlist_remove_id(&self, id: usize) -> Result<(), MpvError>
Remove an entry from the playlist.
sourceasync fn playlist_play_next(&self, id: usize) -> Result<(), MpvError>
async fn playlist_play_next(&self, id: usize) -> Result<(), MpvError>
Play the next entry in the playlist.
sourceasync fn playlist_play_id(&self, id: usize) -> Result<(), MpvError>
async fn playlist_play_id(&self, id: usize) -> Result<(), MpvError>
Play a specific entry in the playlist.
sourceasync fn playlist_move_id(&self, from: usize, to: usize) -> Result<(), MpvError>
async fn playlist_move_id(&self, from: usize, to: usize) -> Result<(), MpvError>
Move an entry in the playlist.
The from
parameter is the current position of the entry, and the to
parameter is the new position.
Mpv will then move the entry from the from
position to the to
position,
shifting after to
one number up. Paradoxically, that means that moving an entry further down the list
will result in a final position that is one less than the to
parameter.
sourceasync fn playlist_clear(&self) -> Result<(), MpvError>
async fn playlist_clear(&self) -> Result<(), MpvError>
Remove all entries from the playlist.
sourceasync fn playlist_add(
&self,
file: &str,
file_type: PlaylistAddTypeOptions,
option: PlaylistAddOptions,
) -> Result<(), MpvError>
async fn playlist_add( &self, file: &str, file_type: PlaylistAddTypeOptions, option: PlaylistAddOptions, ) -> Result<(), MpvError>
Add a file or playlist to the playlist.
sourceasync fn observe_property(
&self,
id: u64,
property: &str,
) -> Result<(), MpvError>
async fn observe_property( &self, id: u64, property: &str, ) -> Result<(), MpvError>
Notify mpv to send events whenever a property changes.
See Mpv::get_event_stream
and Property
for more information.
sourceasync fn unobserve_property(&self, id: u64) -> Result<(), MpvError>
async fn unobserve_property(&self, id: u64) -> Result<(), MpvError>
Stop observing a property.
See Mpv::get_event_stream
and Property
for more information.
sourceasync fn kill(&self) -> Result<(), MpvError>
async fn kill(&self) -> Result<(), MpvError>
Stop mpv completely, and kill the process.
Note that this is different than forcefully killing the process using as handle to a subprocess, it will only send a command to mpv to ask it to exit itself. If mpv is stuck, it may not respond to this command.
sourceasync fn stop(&self) -> Result<(), MpvError>
async fn stop(&self) -> Result<(), MpvError>
Stop the player completely (as opposed to pausing), removing the pointer to the current video.
sourceasync fn set_volume(
&self,
input_volume: f64,
option: NumberChangeOptions,
) -> Result<(), MpvError>
async fn set_volume( &self, input_volume: f64, option: NumberChangeOptions, ) -> Result<(), MpvError>
Set the volume of the player.
sourceasync fn set_speed(
&self,
input_speed: f64,
option: NumberChangeOptions,
) -> Result<(), MpvError>
async fn set_speed( &self, input_speed: f64, option: NumberChangeOptions, ) -> Result<(), MpvError>
Set the playback speed of the player.
sourceasync fn set_playback(&self, option: Switch) -> Result<(), MpvError>
async fn set_playback(&self, option: Switch) -> Result<(), MpvError>
Toggle/set the pause state of the player.
sourceasync fn set_mute(&self, option: Switch) -> Result<(), MpvError>
async fn set_mute(&self, option: Switch) -> Result<(), MpvError>
Toggle/set the mute state of the player.
sourceasync fn set_loop_playlist(&self, option: Switch) -> Result<(), MpvError>
async fn set_loop_playlist(&self, option: Switch) -> Result<(), MpvError>
Toggle/set whether the player should loop the current playlist.
sourceasync fn set_loop_file(&self, option: Switch) -> Result<(), MpvError>
async fn set_loop_file(&self, option: Switch) -> Result<(), MpvError>
Toggle/set whether the player should loop the current video.
sourceasync fn get_playlist(&self) -> Result<Playlist, MpvError>
async fn get_playlist(&self) -> Result<Playlist, MpvError>
Get a list of all entries in the playlist.
sourceasync fn get_metadata(&self) -> Result<HashMap<String, MpvDataType>, MpvError>
async fn get_metadata(&self) -> Result<HashMap<String, MpvDataType>, MpvError>
Get metadata about the current video.
sourceasync fn get_file_path(&self) -> Result<String, MpvError>
async fn get_file_path(&self) -> Result<String, MpvError>
Get the path of the current video.
sourceasync fn get_volume(&self) -> Result<f64, MpvError>
async fn get_volume(&self) -> Result<f64, MpvError>
Get the current volume of the player.
sourceasync fn get_time_pos(&self) -> Result<Option<f64>, MpvError>
async fn get_time_pos(&self) -> Result<Option<f64>, MpvError>
Get the current position in the current video.
sourceasync fn get_time_remaining(&self) -> Result<Option<f64>, MpvError>
async fn get_time_remaining(&self) -> Result<Option<f64>, MpvError>
Get the amount of time remaining in the current video.
sourceasync fn get_duration(&self) -> Result<f64, MpvError>
async fn get_duration(&self) -> Result<f64, MpvError>
Get the total duration of the current video.
sourceasync fn get_playlist_pos(&self) -> Result<usize, MpvError>
async fn get_playlist_pos(&self) -> Result<usize, MpvError>
Get the current position in the playlist.
sourceasync fn is_playing(&self) -> Result<bool, MpvError>
async fn is_playing(&self) -> Result<bool, MpvError>
Check whether the player is currently playing.
sourceasync fn playlist_is_looping(&self) -> Result<LoopProperty, MpvError>
async fn playlist_is_looping(&self) -> Result<LoopProperty, MpvError>
Check whether the player is looping the current playlist.
sourceasync fn file_is_looping(&self) -> Result<LoopProperty, MpvError>
async fn file_is_looping(&self) -> Result<LoopProperty, MpvError>
Check whether the player is looping the current video.