Giter Club home page Giter Club logo

simple-mpv-webui's Introduction

simple-mpv-webui

Build Status License

A web based user interface with controls for the mpv mediaplayer.

Usage

For mpv>=v0.33.0 you can just clone/copy the whole repository into your mpv scripts directory.

Alternatively you can also use the --script or --scripts-append option from mpv or add something like scripts-append=/path/to/simple-mpv-webui/ to mpv.conf.

Installing for mpv <v0.33.0

Copy webui.lua and the webui-page-folder into your mpv scripts directory, mpv will then run it automatically.

Alternatively you can also use the --script or --scripts-append option from mpv or add something like scripts-append=/path/to/simple-mpv-webui/webui.lua to mpv.conf.


See dependencies for more information about the installation.

You can access the webui when visiting http://127.0.0.1:8080 or http://[::1]:8080 in your webbrowser.

By default, it listens on 0.0.0.0:8080 and [::0]:8080. As described below, this can be changed.

Options

Information about how to set options can be found here.

port (int)

Set the port to serve the webui (default: 8080). Setting this allows for running multiple instances on different ports.

Example:

webui-port=8000

ipv4 (bool)

Enable listening on ipv4 (default: yes)

Example:

webui-ipv4=no

ipv6 (bool)

Enable listening on ipv6 (default: yes)

Example:

webui-ipv6=no

disable (bool)

Disable webui (default: no)

Example:

webui-disable=yes

logging (bool)

Log requests to STDOUT (default: no)

Example:

webui-logging=yes

osd_logging (bool)

Log to OSD (default: yes)

Example:

webui-osd_logging=yes

audio_devices (string)

Set the audio-devices used for cycling. By default it uses all interfaces MPV knows of.

You can see a list of them with following command:

mpv --audio-device=help

Example:

webui-audio_devices="pulse/alsa_output.pci-0000_00_1b.0.analog-stereo pulse/alsa_output.pci-0000_00_03.0.hdmi-stereo"

static_dir

Configure the directory from which the static files should be served.

This is useful, if you want to use an alternative frontend.

The provided path may be absolute or relative.

Example:

webui-static_dir="/path/to/directory"

Content types are hardcoded into the server. If you miss something, please create an issue or - even better - a pull request.

htpasswd_path

See authentication below.

Example:

webui-htpasswd_path="/path/to/file"

Relative paths are searched relative to the program's current working directory, so stick to absolute paths all the time.

Shortcuts to your homedir like ~/ are not supported.

collections

In order to use the basic file-browser API at /api/collections, the absolute paths of to-be exposed directories need to be configured here (semicolon delimited). By default, responses from /api/collections remain empty.

Example:

webui-collections="/home/user/Music;/home/user/Videos"

Setting options

There are three ways to set an option for the webui. Please refer to the MPV documentation for more details about this, as this is no feature of the webui.

CLI

If you want to set webui-options from the CLI, you need to pass them to --script-opts or --script-opts-add respectively, like this: --script-opts-add=webui-osd_logging=no.

mpv config file

If you want to set webui-options in the main mpv config file, you need to write it like this: script-opts-add=webui-osd_logging=no.

Webui config file

Finally, if you want to webui-options in their dedicated config file, you can put them in a file /path/to/mpv/user/dir/script-opts/webui.conf (usually ~/.config/mpv/script-opts/webui.conf on Linux) like this: osd_logging=no.

Authentication

There is a very simple implementation of Basic Authentication.

It can be enabled by providing the htpasswd file via the htpasswd_path option. The file does not need to be named htpasswd.

The provided file needs to contain data in the following format:

user1:password1
user2:password2

Only plaintext .htpasswd entries are supported.

Dependencies

Linux

Windows

In this repository you can find a guide, build script and pre-built binaries.

Thanks to @57op for providing this!

macOS

Install luarocks:

brew install luarocks

Check lua version of your mpv instance.

mpv -v

...
--lua=51deb # <- this is your lua version
...

Proceed to install correct luasocket:

luarocks --lua-dir=/usr/local/opt/[email protected] install luasocket

Set correct path:

eval $(luarocks --lua-dir=/usr/local/opt/[email protected] path --bin)

Screenshots

webui screenshot

playlist screenshot

Key bindings

There are some keybindings available:

Key Function
SPACE Play/Pause
ArrowRight seek +10
ArrowLeft seek -10
ArrowUp seek +1min
ArrowDown seek -1min
PageDown seek +3
PageUp seek -3
9 decrease volume
0 increase volume
f toggle fullscreen
n playlist next
p playlist previous
j cycle subtitles
v toggle subtitle visibility
[ decrease playback speed
] increase playback speed
{ decrease playback speed more
} increase playback speed more
Backspace reset playback speed
Escape hide current overlay
? toggle keyboard shortcuts

Media Session API

When using a browser that supports it, simple-mpv-webui uses the Media Session API to provide a notification with some metadata and controls:

notification screenshot

In order to have the notification work properly you need to at least once trigger play from the webui.

Playing other audio while using the webui on Android

For the notification to work, the webui plays a silent audio file in a loop. This is necessary in order for Chrome on Android to create such notification (see). As soon as this silent mp3 is played, audio from other apps is paused automatically by Android. The only way to prevent this from happening is to disable the notifications, which is possible in the settings of the webui (client).

Endpoints

List of endpoints

URI Method Parameter Description
/api/status GET Returns JSON data about playing media --> see below
/api/play POST Play media
/api/pause POST Pause media
/api/toggle_pause POST Toggle play/pause
/api/fullscreen POST Toggle fullscreen
/api/quit POST Quit the program
/api/add/:name/:value POST string and int or float Add :value (default of 1) to the :name property
/api/cycle/:name/:value POST string and up or down Cycle :name by :value (default of up)
/api/multiply/:name/:value POST string and int or float Multiply :name by :value
/api/set/:name/:value POST string and anything Set :name to :value
/api/toggle/:name POST string Toggle the boolean property
/api/seek/:seconds POST int or float (can be negative) Seek
/api/set_position/:seconds POST Go to position :seconds
/api/playlist_prev POST Go to previous media in playlist
/api/playlist_next POST Go to next media in playlist
/api/playlist_jump/:index POST int Jump to playlist item at position :index
/api/playlist_move/:source/:target POST int and int Move playlist item from position :source to position :target
/api/playlist_move_up/:index POST int Move playlist item at position :index one position up
/api/playlist_remove/:index POST int Remove playlist item at position :index
/api/playlist_shuffle POST Shuffle the playlist
/api/loop_file/:mode POST string or int Loop the current file. :mode accepts the same loop modes as mpv
/api/loop_playlist/:mode POST string or int Loop the whole playlist :mode accepts the same loop modes as mpv
/api/add_chapter/:amount POST int (can be negative) Jump :amount chapters in current media
/api/add_volume/:percent POST int or float (can be negative) Add :percent% volume
/api/set_volume/:percent POST int or float Set volume to :percent%
/api/add_sub_delay/:ms POST int or float (can be negative) Add :seconds seconds subtitles delay
/api/set_sub_delay/:ms POST int or float (can be negative) Set subtitles delay to :ms milliseconds
/api/add_audio_delay/:seconds POST int or float (can be negative) Add :seconds seconds audio delay
/api/set_audio_delay/:seconds POST int or float (can be negative) Set audio delay to :seconds milliseconds
/api/cycle_sub POST Cycle trough available subtitles
/api/cycle_audio POST Cycle trough available audio tracks
/api/cycle_audio_device POST Cycle trough audio devices. More information.
/api/speed_set/:speed POST int or float Set playback speed to :speed (defaults to 1 for quick reset)
/api/speed_adjust/:amount POST int or float Multiply playback speed by :amount (where 1.0 is no change)
/api/loadfile/:path/:mode POST :path URL encoded string
:mode string options: replace (default), append, append-play
Load file to playlist. Together with youtube-dl, this also works for URLs
/api/collections/:path GET If no :path is provided, the configured collections are returned. List directories and files (see collections)

All POST endpoints return a JSON message. If successful: {"message": "success"}, otherwise, the message will contain information about the error.

/api/status

metadata contains all the metadata mpv can see, below is just an example:

{
    "audio-delay": 0,        # <-- milliseconds
    "audio-devices": [
        {"active": true, "description": "Autoselect device", "name": "auto"},
        {"active": false, "description": "Default (alsa)", "name": "alsa"},
        {"active": false, "description": "Default (jack)", "name": "jack"},
        {"active": false, "description": "Default (sdl)", "name": "sdl"},
        {"active": false, "description": "Default (sndio)", "name": "sndio"},
    ],
    "chapter": 0,            # <-- current chapter
    "chapters": 0,           # <-- chapters count
    "chapter-list": [        # Array length == "chapters".
        {
            "title": "Chapter 0",
            "time": 0,       # <-- start time in seconds
        },
    ],
    "duration": 6.024,       # <-- seconds
    "end": null,             # <-- seconds as string or null
    "filename": "01 - dummy.mp3",
    "fullscreen": false,
    "loop-file": false,      # <-- false, true or integer
    "loop-playlist": false,  # <-- false, `inf`, `force` or integer
    "metadata": {            # <-- all metadata available to MPV
        "album": "Dummy Album",
        "artist": "Dummy Artist",
        "comment": "0",
        "date": "2020",
        "encoder": "Lavc57.10",
        "genre": "Jazz",
        "title": "First dummy",
    },
    "pause": true,
    "playlist": [
        {
            "current": true,
            "filename": "./environment/test_media/01 - dummy.mp3",
            "id": 1,
            "playing": true,
        },
        {"filename": "./environment/test_media/02 - dummy.mp3", "id": 2},
        {"filename": "./environment/test_media/03 - dummy.mp3", "id": 3},
    ],
    "position": -0.0,        # <-- seconds
    "remaining": 6.024,      # <-- seconds
    "speed": 1,              # <-- multiplier
    "start": null,           # <-- seconds as string or null
    "sub-delay": 0,          # <-- milliseconds
    "track-list": [          # <-- all available video, audio and sub tracks
        {
            "albumart": false,
            "audio-channels": 2,
            "codec": "mp3",
            "decoder-desc": "mp3float (MP3 (MPEG audio layer 3))",
            "default": false,
            "demux-channel-count": 2,
            "demux-channels": "stereo",
            "demux-samplerate": 48000,
            "dependent": false,
            "external": false,
            "ff-index": 0,
            "forced": false,
            "id": 1,
            "image": false,
            "main-selection": 0,
            "selected": true,
            "src-id": 0,
            "type": "audio",
        }
    ],
    "volume": 0,
    "volume-max": 130,
}

Thanks

Thanks to makedin for his work on this.

Differences to mpv-web-ui

  • More media controls
  • Playlist controls
  • Some styles and font-awesome
  • ipv6 support
  • Option to set the port being used (defaults to 8080)
  • Using the Media Session API

Contributing

See CONTRIBUTING.md.

simple-mpv-webui's People

Contributors

agiz avatar dependabot-preview[bot] avatar dependabot[bot] avatar makedin avatar mralext20 avatar nebukadneza avatar oozoraharuto avatar open-dynamix avatar rofrol avatar vapier avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

simple-mpv-webui's Issues

Feature Request: Option to run server in the background and open player only when somethings starts playing

I used https://github.com/iwalton3/plex-mpv-shim for a while, and it runs in the background all the time, which is very convenient.

I found simple-mpv-webui when I was looking for something similar to use with youtube. I share youtube urls on my phone to iOS shortcut, it creates a post request to the /api, and the video starts playing on my PC. However, I have to keep the player open at all times to make this remote cast feature available, and it takes up space in the windows 10 taskbar.

Is it possible to make it run in the background similarly to the plex-mpv-shim? I'm not sure what lua scripts for mpv are capable of. Maybe some python server wrapper, that can be run as a service, is possible? Sadly I'm not experienced in a service scripting, so I decided to propose it as a feature.

Script not working?

I've added the script to my mpv scripts folder (where I already have a functioning script) and it doesn't seem to be working properly. Opening an instance of MPV and entering the webui link into my webbrowser does nothing.

Is there any extra configuration needed?

Your .dependabot/config.yml contained invalid details

Dependabot encountered the following error when parsing your .dependabot/config.yml:

Automerging is not enabled for this account. You can enable it from the [account settings](https://app.dependabot.com/accounts/open-dynaMIX/settings) screen in your Dependabot dashboard.

Please update the config file to conform with Dependabot's specification using our docs and online validator.

collections have been defined but the list is empty.

collections have been defined but the list is empty. Below is the output. What can I do to detect my video directors and files, anything missing? I include the path to main.lua: collections = "/nasd1/Video"

image

No subtitles / no audio features

Hi,
I am using MPV compiled without audio and subtitles. Is there a possibility to detect if audio and or subtitle support is deactivated and include that information in one of the api endpoints response such that the webui can remove or disable the subtitle and audio related buttons?

access from phone? / using another device browser

i like the idea of using through web ,
but i am not able to understand how can i use it with my android device?
i mean i use webui on PC which stream to TV . which i need to control from MOBILE HOWWW?

Feature Request: Add/Modify Tiles

Description

Users should have the function to remove, modify, changing the order, size of the tile and add new tiles.

Examples

Example 1: I wanna change the name of the tile *Slower* to -0.5% and change the color to purple.
Example 2: Adding a tile to open the Info menu `(Shift+I)
Example 3: Adding a tile to activate/deactivate debanding

script-opts=webui-collections in mpv.conf is not working

Hallo

In issue #343 I noticed that I tried to put the collections path into the mpv.conf and this wouldnt work. But I made the error, that I didnt read the whole thing, that I need to add "--script-opts=" as mentioned in the Readme, under Options.
As parameter it works indeed (if I add --script-opts):

mpv --script-opts=webui-collections="C:\Users\f\Desktop\Filme" mymovie.mkv

Now I can check the content of that path with the api/collections:

https://192.168.0.161:8080/api/collections/c%3a%5cusers%5cf%5cdesktop%5cfilme

and as return I get the whole folders and subfolders under this directory.
But when I put the same in mpv.conf as:

script-opts=webui-collections="c:\users\f\desktop\filme"

it doesnt work, despite there are no errors thrown :(
I tried different writings in mpv.conf, all without success, e.g. (I uncommented one by one line):

# script-opts=webui-collections="C:\\Users\\f\\Desktop\\Filme"
# script-opts=webui-collections="C:\Users\f\Desktop\Filme"
# script-opts=webui-collections="c:\\users\\f\\desktop\\filme"
# script-opts=webui-collections="c:/users/f/desktop/filme"
# script-opts=webui-collections='c:/users/f/desktop/filme'
# script-opts=webui-collections='C:\\Users\\f\\Desktop\\Filme'
# script-opts=webui-collections='C:\Users\f\Desktop\Filme'
# script-opts=webui-collections='C:/Users/f/Desktop/Filme'

What could I possibly do wrong, or what is here not working?
Thanks, frank

PS.: This is with simple-mpv-webui 3.0.0 and mpv 2.0 on Windows 10

webui.lua:173: attempt to perform arithmetic on local 'a' (a nil value)

Playing: Music/Compilations/Guradians of the Galaxy vol. 1/The Sweet Fox On The Run.mp3
[ffmpeg/demuxer] mp3: Estimating duration from bitrate, this may be inaccurate
     Video --vid=1 [P] (mjpeg 316x316)
 (+) Audio --aid=1 (mp3 2ch 44100Hz)
File tags:
 Artist: The Sweet
 Album: Guardians of the Galaxy: Awesome Mix, Vol. 2
 Album_Artist: Various Artists
 Composer: Dawn Foxes Music
 Genre: Soundtrack
 Performer: Dawn Foxes Music
 Title: Fox on the Run (Single Version)
 Track: 2
AO: [pulse] 44100Hz stereo 2ch s16
[webui] 
[webui] stack traceback:
[webui]         /home/alexander/.config/mpv/scripts/webui.lua:173: in function 'round'
[webui]         /home/alexander/.config/mpv/scripts/webui.lua:243: in function 'build_json_response'
[webui]         /home/alexander/.config/mpv/scripts/webui.lua:277: in function </home/alexander/.config/mpv/scripts/webui.lua:276>
[webui]         (...tail calls...)
[webui]         /home/alexander/.config/mpv/scripts/webui.lua:371: in function 'listen'
[webui]         /home/alexander/.config/mpv/scripts/webui.lua:408: in function 'cb'
[webui]         mp.defaults:320: in function 'process_timers'
[webui]         mp.defaults:478: in function 'dispatch_events'
[webui]         mp.defaults:451: in function <mp.defaults:450>
[webui]         [C]: in ?
[webui]         [C]: in ?
[webui] Lua error: /home/alexander/.config/mpv/scripts/webui.lua:173: attempt to perform arithmetic on local 'a' (a nil value)

this causes a crash of the webui.

Feature Request: open a file to play through the WebUI

Hallo
still thanks for the great work, really use and appreciate it :)

I have a Feature Request: could it be possible to open a file from the computer, where mpv is running, so that mpv will play it, using your WebUI?
I can start mpv remotely in the foreground with ssh (same user than the console user) on a Windows 10 Computer with:
schtasks /create /TN RunMPV /RU DeinUser /tr mpv.exe /sc EINMAL /ST 00:00
and then start mpv in the foreground with:
schtasks /run /tn RunMPV

The WebUI is indeed active, I can do commands (fullscreen e.g.) to mpv, but I cannot load a movie or file.

It would be great if I would get grip of the Desktop or the user's folder in a Dialog or List to open something.

Thanks!
frank

do we have `web-ui.conf` ?

why there is no web-ui.conf which goes to /config/sciprt-opts/webui.conf
i mean i read options but not seem to have configuration file?
am i wrong?

also the option webui- threw me this error ๐Ÿ™ i dont know what i did wrong
image

if i used cli parameters like --webui-osd_logging=yes got this error
image

what im dong wrong ?

image
also how to webui.conf
im still confsued i made one but seem to ani't workign

Knocks off other HTTP stream whenever interface sends a GET request?

Hi!

Really love the interface, however I've run into a strange issue. Please bear with me, as it's a little esoteric:

I currently have VLC serving a FLAC stream of my HTPC's audio over HTTP. Everything I play with MPV by itself plays fine over HTTP/FLAC with no issues. However, if I drop simple-mpv-webui in there and start MPV up, the audio starts to play as usual, but the HTTP stream will get knocked off the client (e.g. the stream closes and has to be manually reconnected) every time the webui interface sends MPV a GET request to refresh the UI. This seems entirely localized to the HTTP stream, as MPV and the audio media continue to play fine over the HTPC's hardware connection while all this is happening.

I should also mention that the HTTP stream and simple-mpv-webui run on different ports, so I've eliminated that as a possible error source. I've spent the better part of this afternoon pinning this issue down, so I'm fairly confident it's a real thing, but I'm at a loss as to what logs/info would be required to isolate and fix this. Please let me know and I will gladly gather whatever's necessary.

Thanks!

Crash of mpv v0.38.0

I'm on windows 10, and I updated mpv from the latest master version of v37 (14-04) to stable v38 (20-04) and now after a short time when I start mpv there is some loading and it closes, I went to remove the scripts one by one and it turns out that this is what causes it to crash. I don't know what may have been changed this week but if I remove this script everything works perfectly, can someone check?

this is the log file with the base v38 without settings and with only this script loaded: v38.log

About collection handling

Hey @open-dynaMIX !
I'm the developer of mpv-remote-app
We've talked about switching to your backend. I've an idea how filebrowser extension can be implemented, for handling collections on my frontend app.

API route for example:
/api/browse_files/"<directory_path1>";"<directory_path2>";

We should only get response of supported formats by MPV, file formats can be found here
The response should return sub-directories first and files afterwards, but it's not big deal to implement this on my frontend, if you don't implement it.

Response (something like this):

[
    {
        "fullPath": "/home/user/media/subdir1",
        "name": "subdir1",
        "type": "directory"
    },
    {
        "fullPath": "/home/user/media/subdir2",
        "name": "subdir2",
        "type": "directory"
    },
    {
        "fullPath": "/home/user/media/movie.mkv",
        "name": "movie.mkv",
        "type": "video",
    },
    {
        "fullPath": "/home/user/media/movie.ass",
        "name": "movie.ass",
        "type": "subtitle",
    },
    {
        "fullPath": "/home/user/media1/music.mp3",
        "name": "music.mp3",
        "type": "audio",
    },
]

My implementation of this on node backend

If you need any more info please let me know. I would implement this by myself, but I don't have Lua coding experience.

script_path issue on windows

Hi,
I just noticed that debug.getinfo(2, "S").source on windows doesn't return (anymore?) a path prefixed by @. It returns the path directly.
So, :sub(2) will remove the drive letter (e.g. Z:/path/to/mpv โ†’ :/path/to/mpv) resulting in 404 error by the web server (because it cannot read any files).

This is very weird because it has been working before.
I recently upgraded both windows (version 2004) and mpv.

The maintainer of mpv windows release I use has recently made some changes to luajit:
shinchiro/mpv-winbuild-cmake@7040592

It could be any of these two changes.

I'm opening this issue just to inform any windows user of this plugin.
I don't think any change should be "officialy" made to webui.lua file to fix this quirk,
but windows user might want to temporary modify that file removing :sub(2) on line 12 in order to continue to use this plugin for the time being.

Please make it more clear that this uses dependencies!

I know it's not right to blame the dev because I'm a user that didnt read the whole readme and am intoxicated by my windows upbringing but please make it more clear at the start of the readme or something that this has dependencies that aren't included by default. I have been freaking out all day and was about to give up MPV because it was my first time installing it and seeing that plugins didnt work and that windows users are 'second-class' made me miserable.

Especially at the part after Usage, when I see dependencies my brain already is thinking "ok something included already in the download probably, it just says clone the repo", and I didn't see that the installing for mpv <v0.33.0 was a dropdown so I just didn't read it because I was on a newer version and completely missed the thing about dependency information.

remove unwanted text when opening

i am getting this error

Cannot find main.* for any supported scripting backend in: C:/Users/O_0/scoop/apps/mpv-git/current/portable_config/scripts/webui-page

also this i want to remove this from pop-up when i enter mpv
image

script-opts: unknown key audio-devices, ignoring

This is about the released version 0.3.1.
I put to mpv.conf the following setting:
script-opts=webui-audio-devices=pulse/combined pulse/alsa_output.pci-0000_00_01.1.hdmi-stereo pulse/alsa_output.pci-0000_00_14.2.analog-stereo

When mpv starts, the console shows the following:
[webui] script-opts: unknown key audio-devices, ignoring

So, the provided list doesn't have any effect.
Changing "webui-audio-devices" to "webui-audio_devices" fixes the problem, but the documentation says about "audio-devices".
The code should reflect the documentation.

Add option to stream audio over HTTP

Would be rather a chore, and having audio stream correctly even more so.... but, was interested in getting it to happen, so I could use audio with a handheld device (ie: phone) while viewing on an external device (ie: tv)

This is more of a wish than an issue, and would (probably) be at least some degree of a pain to implement (especially since the latency would be more variable than on-device).

Thank you.

error at startup: cannot find main.* for scripting backend

When I start mpv with the script installed, I get the following error:

$ DISPLAY=:0 mpv --playlist-start=10 --start=0:00 /nfs/n40lnas/\[SubsPlease\]\ Shiroi\ Suna\ no\ Aquatope\ -\ *
   cplayer: Cannot find main.* for any supported scripting backend in: /etc/mpv/scripts/webui-page
     webui: v2.2.0
     webui: [::]:8080
     webui: 192.168.88.51:8080 
   cplayer: Playing: /nfs/n40lnas/[SubsPlease] Shiroi Suna no Aquatope - 11 (720p) [18AD4A03].mkv
   cplayer:  (+) Video --vid=1 (*) (h264 1280x720 23.976fps)
   cplayer:  (+) Audio --aid=1 --alang=jpn (*) (aac 2ch 44100Hz)
   cplayer:  (+) Subs  --sid=1 --slang=eng (*) 'English subs' (ass)
        vd: Using hardware decoding (nvdec-copy).
   cplayer: AO: [alsa] 44100Hz stereo 2ch s32
   cplayer: VO: [gpu] 1280x720 nv12
statusline: (Paused) AV: 00:00:14 / 00:23:37 (1%) A-V:  0.000 DS: 3.000/0 Cache: 285s/150MB
   cplayer: 
   cplayer: Playing: /nfs/n40lnas/[SubsPlease] Shiroi Suna no Aquatope - 12 (720p) [3CEABAAE].mkv
     webui: Could not fetch "remaining" from mpv. 
     webui: Could not fetch "chapters" from mpv. 
     webui: Could not fetch "position" from mpv. 
     webui: Could not fetch "metadata" from mpv. 
     webui: Could not fetch "duration" from mpv. 
     webui: This is normal during startup. 

The script works otherwise. Is there some functionality lacking if main.* cannot be found? Also, the options are not working for me in mpv.conf. I am using script-opts=webui-static_dir='/etc/mpv/webui-page' or '/etc/mpv/webui-page/static' and the directory cannot be found.

Can't control mpv windows 10

Using
windows 10 x64 tested on 2004, 14393
mpv-0.32.0-x86_64 by shinchiro

The keystrokes don't get sent to mpv, pressing the buttons don't work as well, the webpage loads so it must be serving it. It works fine on windows 8.1. Uppon looking at the console the error is "Uncaught ReferenceError: send is not defined"

Thanks for the help.

Audio devices are not cycled when audio-devices setting is missing

This is about the release 0.3.1.
Let's not use audio-devices option in the command line or in the configuration. The documentation says "By default it uses all interfaces MPV knows of."

But in fact there is a problem with the default.

When mpv starts, no problems are reported. But when I press "Audio device" in the web interface, the following error is reported in the console:
[ao] Audio output 123456789101112131415161718 not found!
[ao] Failed to initialize audio driver '123456789101112131415161718'
Could not open/initialize audio device -> no sound.

I have a list of auto, pulse, alsa, jack and sdl audio devices according to "mpv --audio-device=help". But the mentioned above device is not present in the list.

Further attempts to press "Audio device" have no effect.

Expected result: all available to MPV audio devices should be cycled when I press "Audio device".

FR - Show mpv-start-options in the WebUI

Hallo

I use mpv to show movies to my children, but not too long, only some few minutes, e.g. old Disney Cartoons.
I start the movies (full play time about 3 hours) from a start time to an end time with the options --start= and --end=
To show the end option, and to know when the kids movie-time will be over, I write the end time additionaly to the screen, with e.g.: --osg-msg1="Ende: 7:24", so I can see, how many time left (e.g. by pressing "o" to see the actual time tag).

Now I found this great tool here, simple-mpv-webui, which is a good help already, I can see on my phone (without need to stay in the movie-room), at what time the movie is.
But I have to remember the end-time, it is not to find in the WebUI page.

Could it be done theoretically that the webui.lua hands over the mpv-options (--start and --end) to the WebUI?
Or is that beyond the scope of the capabilities of lua scripts?
I don't know if Lua can get grip of that.

Thanks for hints.
frank

EDIT: I found this documentation: LUA SCRIPTING about it, but it would take hours for me to understand it ๐Ÿ˜ข

webui.lua throws lua error

when launching mpv it throws an error:
webui.lua:541: bad argument #1 to 'pairs' (table expected, got nil)

my setup is a raspberry pi 2 with devuan:

$ cat /etc/issue
Devuan GNU/Linux ascii \n \l
$ uname -a
Linux roadhouse 4.19.83-v7+ #1277 SMP Mon Nov 11 16:30:44 GMT 2019 armv7l GNU/Linux

what i did (mpv is already installed and working):

$ sudo apt install lua5.2 lua5.2-dev luarocks
$ sudo luarocks install luasocket
$ git clone https://github.com/open-dynaMIX/simple-mpv-webui.git
$ cp -a webui.lua webui-page ~/.config/mpv/scripts
$ mpv --no-video http://youtube.com/<something>

full error:

$ mpv --no-video 'https://youtu.be/C7L0eNPge98'
[webui]
[webui] stack traceback:
[webui]         [C]: in function 'pairs'
[webui]         /home/bamdad/simple-mpv-webui/webui.lua:541: in main chunk
[webui]         [C]: in ?
[webui]         [C]: in ?
[webui] Lua error: /home/bamdad/simple-mpv-webui/webui.lua:541: bad argument #1 to 'pairs' (table expected, got nil)
Playing: https://youtu.be/C7L0eNPge98

^C
Exiting... (Quit)

am i doing something horribly wrong?

thanks,
bamdad

Lua error: error loading module 'socket.core'

Hi,

I am trying to run this on an old android phone inside a termux environment to use it as a wireless music station.
Unfortunately I am gettings the following error:

~/KH-Disc 1 $ mpv .
[simple_mpv_webui]
[simple_mpv_webui] stack traceback:
[simple_mpv_webui]      [C]: in ?
[simple_mpv_webui]      [C]: in function 'require'
[simple_mpv_webui]      /data/data/com.termux/files/usr/share/lua/5.2/socket.lua:12: in main chunk
[simple_mpv_webui]      [C]: in function 'require'
[simple_mpv_webui]      ...files/home/.config/mpv/scripts/simple-mpv-webui/main.lua:4: in main chunk
[simple_mpv_webui]      [C]: in ?
[simple_mpv_webui]      [C]: in ?
[simple_mpv_webui] Lua error: error loading module 'socket.core' from file '/data/data/com.termux/files/usr/lib/lua/5.2/socket/core.so':
[simple_mpv_webui]      dlopen failed: cannot locate symbol "lua_createtable" referenced by "/data/data/com.termux/files/usr/lib/lua/5.2/socket/core.so"...
[file] This is a directory - adding to playlist.

lua -v gives me

~/KH-Disc 1 $ lua -v
Lua 5.2.4  Copyright (C) 1994-2015 Lua.org, PUC-Rio

Additionally, luasocket I have installed using luarocks the following way:

~/KH-Disc 1 $ luarocks --lua-version 5.2 install luasocket
Warning: falling back to wget - install luasec to get native HTTPS support
Installing https://luarocks.org/luasocket-3.1.0-1.src.rock

luasocket 3.1.0-1 depends on lua >= 5.1 (5.2-1 provided by VM)
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/mime.c -o src/mime.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/compat.c -o src/compat.o -DLUASOCKET_DEBUG
gcc  -shared -o mime/core.so src/mime.o src/compat.o
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/buffer.c -o src/buffer.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/compat.c -o src/compat.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/auxiliar.c -o src/auxiliar.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/options.c -o src/options.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/timeout.c -o src/timeout.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/io.c -o src/io.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/usocket.c -o src/usocket.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/serial.c -o src/serial.o -DLUASOCKET_DEBUG
gcc  -shared -o socket/serial.so src/buffer.o src/compat.o src/auxiliar.o src/options.o src/timeout.o src/io.o src/usocket.o src/serial.o
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/buffer.c -o src/buffer.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/compat.c -o src/compat.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/auxiliar.c -o src/auxiliar.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/options.c -o src/options.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/timeout.c -o src/timeout.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/io.c -o src/io.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/usocket.c -o src/usocket.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/unix.c -o src/unix.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/unixdgram.c -o src/unixdgram.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/unixstream.c -o src/unixstream.o -DLUASOCKET_DEBUG
gcc  -shared -o socket/unix.so src/buffer.o src/compat.o src/auxiliar.o src/options.o src/timeout.o src/io.o src/usocket.o src/unix.o src/unixdgram.o src/unixstream.o
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/luasocket.c -o src/luasocket.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/timeout.c -o src/timeout.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/buffer.c -o src/buffer.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/io.c -o src/io.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/auxiliar.c -o src/auxiliar.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/options.c -o src/options.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/inet.c -o src/inet.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/except.c -o src/except.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/select.c -o src/select.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/tcp.c -o src/tcp.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/udp.c -o src/udp.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/compat.c -o src/compat.o -DLUASOCKET_DEBUG
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.2 -c src/usocket.c -o src/usocket.o -DLUASOCKET_DEBUG
gcc  -shared -o socket/core.so src/luasocket.o src/timeout.o src/buffer.o src/io.o src/auxiliar.o src/options.o src/inet.o src/except.o src/select.o src/tcp.o src/udp.o src/compat.o src/usocket.o
luasocket 3.1.0-1 is now installed in /data/data/com.termux/files/usr (license: MIT)

Checking stability of dependencies in the absence of
luasocket 3.0rc1-2...

Removing luasocket 3.0rc1-2...
Removal successful.

Any advice how I could get this script running properly?
Thanks

bogus setup.cfg symlink

guessing this wasn't meant to be an absolute symlink
setup.cfg -> /home/fabio/code/simple-mpv-webui/tests/setup.cfg

Fails to load socket.lua

Somehow, it is trying to load stuff from lua 5.2. Installed from master (8429305), also installed packages lua-socket*' through apt installandluarocksas described inREADME.md`.

Error message:

[webui]
[webui] stack traceback:
[webui]         [C]: in function 'require'
[webui]         /home/hyiltiz/.config/mpv/scripts/webui.lua:4: in main chunk
[webui]         [C]: in ?
[webui]         [C]: in ?
[webui] Lua error: /home/hyiltiz/.config/mpv/scripts/webui.lua:4: module 'socket' not found:
[webui]         no field package.preload['socket']
[webui]         no file '/usr/local/share/lua/5.2/socket.lua'
[webui]         no file '/usr/local/share/lua/5.2/socket/init.lua'
[webui]         no file '/usr/local/lib/lua/5.2/socket.lua'
[webui]         no file '/usr/local/lib/lua/5.2/socket/init.lua'
[webui]         no file '/usr/share/lua/5.2/socket.lua'
[webui]         no file '/usr/share/lua/5.2/socket/init.lua'
[webui]         no file '/usr/local/lib/lua/5.2/socket.so'
[webui]         no file '/usr/lib/x86_64-linux-gnu/lua/5.2/socket.so'
[webui]         no file '/usr/lib/lua/5.2/socket.so'
[webui]         no file '/usr/local/lib/lua/5.2/loadall.so'

Versions:

mpv 0.32.0 Copyright ยฉ 2000-2020 mpv/MPlayer/mplayer2 projects
 built on UNKNOWN
ffmpeg library versions:
   libavutil       56.51.100
   libavcodec      58.91.100
   libavformat     58.45.100
   libswscale      5.7.100
   libavfilter     7.85.100
   libswresample   3.7.100
ffmpeg version: 4.3-3+b1


Linux version 5.7.0-1-amd64 ([email protected]) (gcc version 9.3.0 (Debian 9.3.0-14), GNU ld (GNU Binutils for Debian) 2.34) #1 SMP Debian 5.7.6-1 (2020-06-24)

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux bullseye/sid
Release:        testing
Codename:       bullseye

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.