send_command

Function send_command 

Source
pub fn send_command(command: Command) -> bool
Expand description

Sends a media command to the currently active media client.

This function sends a command to the media remote system, instructing the currently active media client to perform a specific action.

§Note

  • The useInfo argument is not supported by this function and is not used in the current implementation.
  • If no media is currently playing, this function may open iTunes (or the default media player) to handle the command.

§Arguments

  • command: The Command to be sent to the media client. This can represent various actions such as play, pause, skip, or volume control.

§Returns

  • bool:
    • true if the command was successfully sent and processed.
    • false if the operation failed or the command was not recognized.

§Example

use media_remote::{send_command, Command};

if send_command(Command::Play) {
    println!("Command sent successfully.");
} else {
    println!("Failed to send command.");
}