Coder Social home page Coder Social logo

go-omxremote's Introduction

go-omxremote

Control raspberry pi omxplayer from the browser (including mobile browsers). It has absolutely zero dependencies. To install just download the latest release and run it. For help run it with the -h flag. Example usage (you can of course add it in your path and run it as a systemd service, unit file example below):

./go-omxremote -bind :some-port -media path/to/video/files

Command flags:

-bind string
    Address to bind on. If this value has a colon, as in ":8000" or
            "127.0.0.1:9001", it will be treated as a TCP address.
            (default ":31415")
-media string
    path to look for videos in (default ".")

-omx string
    omx options (default "-o hdmi")

The project is geared towards mobile usage, the interface has been tested on both Android and iOS devices. This project is intended to be used with local files only, to add YouTube playback functionality please check out this fork.

Exposed HTTP API

This application exposes a simple, minimal HTTP API for interfacing with the player. The exposed endpoints are:

  • POST /start/:hash - starts playback for a video file
  • POST /player/pause - toggles pause/play for video playback
  • POST /player/stop - stops playback
  • POST /player/forward - seeks forward in video (30 seconds)
  • POST /player/backward - seeks backward in video (30 seconds)
  • POST /player/up - seeks forward in video (10 minutes)
  • POST /player/down - seeks backward in video (10 minutes)
  • POST /player/subs - switches subs stream

One important note is that the start call does not return until the playback is stopped, so your request will probably time out.

Example systemd unit file

A minimal systemd unit file. It makes go-omxremote a service so you can control it between sessions and/or don't need a tmux/screen to keep it open.

[Unit]
Description="omxremote go web service"

[Service]
User=pi
Group=pi
Restart=on-failure
ExecStart=/usr/local/bin/go-omxremote -media /path/to/media/files
WorkingDirectory=/home/pi

[Install]
WantedBy=multi-user.target

Modify it

  • Clone repo
  • make some changes
  • build again: go build

Credits

It's written in go. The front-end is written in html with a little sprinkled htmx, the style uses picocss.

go-omxremote's People

Contributors

dependabot[bot] avatar dplesca avatar gfalcone avatar krizex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

go-omxremote's Issues

Python control of webservice ?

Hi There,

Can I use this to control the omxplayer from a remote python script ? I would essentially just send a post/get request to start and stop a video from my python script.

If so can you provide a basic example of the get/post request to stop and start a video

Thanks :)

Playlist support

Looks great, but how about playlist support? Or playling just all found files. Thanks!

Option to pass to omxplayer like in omx remote app ?

Hey there,

thanks, it works great. One thing though: to have sound through my DAQ I usually pass the option --adev alsa. Do you know of a way to pass it to omxplayer by means of modifying something in your code, or maybe you know how to modify /usr/bin/omxplayer to achieve that ?

Thanks !

Gustavo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.