media.omxplayer
Platypush documentation
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:
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 https://python-omxplayer-wrapper.readthedocs.io/en/latest/omxplayer/#omxplayer.player.OMXPlayer
timeout – How long the plugin should wait for a video to start upon play request (default: 20 seconds).
- 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
- 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, }