platypush.plugins.media.omxplayer

class platypush.plugins.media.omxplayer.MediaOmxplayerPlugin(args=None, *argv, **kwargs)[source]

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, **kwargs)[source]
Parameters:args (list) – Arguments that will be passed to the OMXPlayer constructor (e.g. subtitles, volume, start position, window size etc.) see https://github.com/popcornmix/omxplayer#synopsis and http://python-omxplayer-wrapper.readthedocs.io/en/latest/omxplayer/#omxplayer.player.OMXPlayer
back(offset=60)[source]

Back by (default: 60) seconds

forward(offset=60)[source]

Forward by (default: 60) seconds

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, subtitles=None, *args, **kwargs)[source]

Play 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(relative_position)[source]

Seek backward/forward by the specified number of seconds

Parameters:relative_position (int) – Number of seconds relative to the current cursor
set_position(position)[source]

Seek backward/forward to the specified absolute position

Parameters:position (int) – Number of seconds from the start
set_volume(volume)[source]

Set the volume

Parameters:volume (int) – 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()[source]

Volume down by 10%

volup()[source]

Volume up by 10%

class platypush.plugins.media.omxplayer.PlayerEvent[source]

An enumeration.