media.omxplayer#

class platypush.plugins.media.omxplayer.MediaOmxplayerPlugin(args=None, *argv, timeout: float = 20.0, **kwargs)[source]#

Bases: MediaPlugin

Plugin to control video and media playback using OMXPlayer.

Requires:

  • omxplayer installed on your system (see your distro instructions)

  • omxplayer-wrapper (pip install omxplayer-wrapper)

__init__(args=None, *argv, timeout: float = 20.0, **kwargs)[source]#
Parameters:
back(offset=30)[source]#

Back by (default: 30) seconds

forward(offset=30)[source]#

Forward by (default: 30) seconds

get_volume() float[source]#
Returns:

The player volume in percentage [0, 100].

hide_subtitles()[source]#

Hide the subtitles

hide_video()[source]#

Hide the video

is_playing()[source]#
Returns:

True if it’s playing, False otherwise

load(resource, pause=False, **kwargs)[source]#

Load a resource/video in the player.

Parameters:
  • resource (str) – URL or filename to load

  • pause (bool) – If set, load the video in paused mode (default: False)

metadata()[source]#

Get the metadata of the current video

mute()[source]#

Mute the player

next()[source]#

Play the next track/video

pause()[source]#

Pause the playback

play(resource=None, subtitles=None, *args, **kwargs)[source]#

Play or resume playing a resource.

Parameters:
  • resource

    Resource to play. Supported types:

    • Local files (format: file://<path>/<file>)

    • Remote videos (format: https://<url>/<resource>)

    • YouTube videos (format: https://www.youtube.com/watch?v=<id>)

    • Torrents (format: Magnet links, Torrent URLs or local Torrent files)

  • subtitles – Subtitles file

quit()[source]#

Quit the player

seek(position)[source]#

Seek to the specified number of seconds from the start.

Parameters:

position (float) – Number of seconds from the start

set_position(position)[source]#

Seek to the specified number of seconds from the start (same as seek()).

Parameters:

position (float) – Number of seconds from the start

set_volume(volume)[source]#

Set the volume

Parameters:

volume (float) – Volume value between 0 and 100

status()[source]#

Get the current player state.

Returns:

A dictionary containing the current state.

Format:

output = {
    "duration": Duration in seconds,
    "filename": Media filename,
    "fullscreen": true or false,
    "mute": true or false,
    "path": Media path
    "pause": true or false,
    "position": Position in seconds
    "seekable": true or false
    "state": play, pause or stop
    "title": Media title
    "url": Media url
    "volume": Volume between 0 and 100
    "volume_max": 100,
}
stop()[source]#

Stop the playback (same as quit)

unmute()[source]#

Unmute the player

voldown(step=10.0)[source]#

Decrease the volume.

Parameters:

step (float) – Volume decrease step between 0 and 100 (default: 10%).

volup(step=10.0)[source]#

Increase the volume.

Parameters:

step (float) – Volume increase step between 0 and 100 (default: 10%).

class platypush.plugins.media.omxplayer.PlayerEvent(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum