Skip to main content

Controller

Trait Controller 

Source
pub trait Controller {
Show 16 methods // Required method fn is_info_some(&self) -> bool; // Provided methods fn toggle(&self) -> bool { ... } fn play(&self) -> bool { ... } fn pause(&self) -> bool { ... } fn next(&self) -> bool { ... } fn previous(&self) -> bool { ... } fn toggle_shuffle(&self) -> bool { ... } fn toggle_repeat(&self) -> bool { ... } fn start_forward_seek(&self) -> bool { ... } fn end_forward_seek(&self) -> bool { ... } fn start_backward_seek(&self) -> bool { ... } fn end_backward_seek(&self) -> bool { ... } fn go_back_fifteen_seconds(&self) -> bool { ... } fn skip_fifteen_seconds(&self) -> bool { ... } fn set_playback_speed(&self, speed: i32) { ... } fn set_elapsed_time(&self, elapsed_time: f64) { ... }
}

Required Methods§

Provided Methods§

Source

fn toggle(&self) -> bool

Toggles between play and pause states.

§Returns
  • true if the command was successfully sent.
  • false if the command failed.
§Example
use media_remote::prelude::*;

let now_playing = NowPlaying::new();
now_playing.toggle();
Source

fn play(&self) -> bool

Play the currently playing media.

§Returns
  • true if the command was successfully sent.
  • false if the operation failed.
§Example
use media_remote::prelude::*;

let now_playing = NowPlaying::new();
now_playing.play();
Source

fn pause(&self) -> bool

Pauses the currently playing media.

§Returns
  • true if the command was successfully sent.
  • false if the command failed.
§Example
use media_remote::prelude::*;

let now_playing = NowPlaying::new();
now_playing.pause();
Source

fn next(&self) -> bool

Skips to the next track in the playback queue.

§Returns
  • true if the command was successfully sent.
  • false if the command failed.
§Example
use media_remote::prelude::*;

let now_playing = NowPlaying::new();
now_playing.next();
Source

fn previous(&self) -> bool

Returns to the previous track in the playback queue.

§Returns
  • true if the command was successfully sent.
  • false if the command failed.
§Example
use media_remote::prelude::*;

let now_playing = NowPlaying::new();
now_playing.previous();
Source

fn toggle_shuffle(&self) -> bool

Toggles the shuffle state of the playback queue.

§Returns
  • true if the command was successfully sent.
  • false if the command failed.
§Example
use media_remote::prelude::*;

let now_playing = NowPlaying::new();
now_playing.toggle_shuffle();
Source

fn toggle_repeat(&self) -> bool

Toggles the repeat state of the playback queue.

§Returns
  • true if the command was successfully sent.
  • false if the command failed.
§Example
use media_remote::prelude::*;

let now_playing = NowPlaying::new();
now_playing.toggle_repeat();
Source

fn start_forward_seek(&self) -> bool

Starts a forward seek operation.

§Returns
  • true if the command was successfully sent.
  • false if the command failed.
§Example
use media_remote::prelude::*;

let now_playing = NowPlaying::new();
now_playing.start_forward_seek();
Source

fn end_forward_seek(&self) -> bool

Ends a forward seek operation.

§Returns
  • true if the command was successfully sent.
  • false if the command failed.
§Example
use media_remote::prelude::*;

let now_playing = NowPlaying::new();
now_playing.end_forward_seek();
Source

fn start_backward_seek(&self) -> bool

Starts a backward seek operation.

§Returns
  • true if the command was successfully sent.
  • false if the command failed.
§Example
use media_remote::prelude::*;

let now_playing = NowPlaying::new();
now_playing.start_backward_seek();
Source

fn end_backward_seek(&self) -> bool

Ends a backward seek operation.

§Returns
  • true if the command was successfully sent.
  • false if the command failed.
§Example
use media_remote::prelude::*;

let now_playing = NowPlaying::new();
now_playing.end_backward_seek();
Source

fn go_back_fifteen_seconds(&self) -> bool

Seeks backward by fifteen seconds.

§Returns
  • true if the command was successfully sent.
  • false if the command failed.
§Example
use media_remote::prelude::*;

let now_playing = NowPlaying::new();
now_playing.go_back_fifteen_seconds();
Source

fn skip_fifteen_seconds(&self) -> bool

Skips forward by fifteen seconds.

§Returns
  • true if the command was successfully sent.
  • false if the command failed.
§Example
use media_remote::prelude::*;

let now_playing = NowPlaying::new();
now_playing.skip_fifteen_seconds();
Source

fn set_playback_speed(&self, speed: i32)

Sets the playback speed of the currently active media client.

§Arguments
  • speed: The playback speed multiplier.
§Note
  • Playback speed changes typically do not work most of the time. Depending on the media client or content, setting the playback speed may not have the desired effect.
§Example
use media_remote::prelude::*;

let now_playing = NowPlaying::new();
now_playing.set_playback_speed(2);
Source

fn set_elapsed_time(&self, elapsed_time: f64)

Sets the elapsed time of the currently playing media.

§Arguments
  • elapsed_time: The elapsed time in seconds to set the current position of the media.
§Note
  • Limitations: Setting the elapsed time can often cause the media to pause. Be cautious when using this function, as the playback might be interrupted and require manual resumption.
§Example
use media_remote::prelude::*;

let now_playing = NowPlaying::new();
now_playing.set_elapsed_time(1.0);

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§