mcastorina / mpv-remote-app Goto Github PK
View Code? Open in Web Editor NEWAndroid app to control mpv running on another computer
License: GNU General Public License v3.0
Android app to control mpv running on another computer
License: GNU General Public License v3.0
Have a way to display timestamp. Options include:
I am able to communicate from the Android app to the python server, however every command sent to mpv comes back failed. Here is some of the output:
{'time': 1546583672857, 'value': True, 'command': 'set', 'property': 'pause'}
Error setting property: pause = True
ACK {"message": null, "time": 1546583672952, "action": 1546583672857, "result": false}
{'time': 1546583701036, 'value': True, 'command': 'set', 'property': 'pause'}
Error setting property: pause = True
ACK {"message": null, "time": 1546583701129, "action": 1546583701036, "result": false}
{'time': 1546583701852, 'value': True, 'command': 'set', 'property': 'pause'}
Error setting property: pause = True
ACK {"message": null, "time": 1546583701944, "action": 1546583701852, "result": false}
{'time': 1546583745526, 'value': 59, 'command': 'set', 'property': 'volume'}
Error setting property: volume = 59
ACK {"message": null, "time": 1546583745618, "action": 1546583745526, "result": false}
{'pre': None, 'post': '%', 'time': 1546583745542, 'command': 'show', 'property': 'volume'}
ACK {"message": "", "time": 1546583745630, "action": 1546583745542, "result": true}
{'time': 1546583745550, 'value': True, 'command': 'set', 'property': 'pause'}
Error setting property: pause = True
ACK {"message": null, "time": 1546583745640, "action": 1546583745550, "result": false}
{'time': 1546583745932, 'value': True, 'command': 'set', 'property': 'pause'}
Error setting property: pause = True
ACK {"message": null, "time": 1546583746023, "action": 1546583745932, "result": false}
{'time': 1546583763872, 'value': True, 'command': 'set', 'property': 'fullscreen'}
Error setting property: fullscreen = True
ACK {"message": null, "time": 1546583763966, "action": 1546583763872, "result": false}
I can confirm mpv is started with the --input-ipc-server mpv_socket option.
mpv git-2018-11-18-ce2253b Copyright © 2000-2018 mpv/MPlayer/mplayer2 projects
built on Mon Dec 17 05:57:11 UTC 2018
ffmpeg library versions:
libavutil 56.24.101
libavcodec 58.42.102
libavformat 58.24.101
libswscale 5.4.100
libavfilter 7.46.101
libswresample 3.4.100
ffmpeg version: git-2018-12-16-de5e71f
mpv
relies on youtube-dl
to play videos from various services and accepts urls as input.
Handling ACTION_SEND
intent for shared urls from other apps by mpv-remote
and passing those urls to mpv
to play or to add into a queue would drastically improve the user experience.
Spawning the Library Activity will always start at the server's root directory. It is more convenient to save the last directory that was navigated to.
It's easier to control volume with physical buttons.
Windows 10 user
powershell showing this error
was running as admin
PS C:\Users\manan> mpv-remote-app password
Traceback (most recent call last):
File "c:\users\manan\appdata\local\programs\python\python37\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\users\manan\appdata\local\programs\python\python37\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\manan\AppData\Local\Programs\Python\Python37\Scripts\mpv-remote-app.exe_main.py", line 9, in
File "c:\users\manan\appdata\local\programs\python\python37\lib\site-packages\mpv_remote_app_init.py", line 85, in main
set_root(args)
File "c:\users\manan\appdata\local\programs\python\python37\lib\site-packages\mpv_remote_app_init_.py", line 49, in set_root
args.root = abspath(realpath((args.root)))
File "c:\users\manan\appdata\local\programs\python\python37\lib\ntpath.py", line 526, in abspath
return normpath(_getfullpathname(path))
TypeError: _getfullpathname: path should be string, bytes or os.PathLike, not NoneType
PS C:\Users\manan>
There's a directory with a couple thousands of files. When entering here via clent, server dies:
INFO:root:Received command: "{'time': 1623258978499, 'directory': './curl/ftp_shares/volb/v', 'command': 'list'}"
Traceback (most recent call last):
File "/home/bfg/.local/bin/mpv-remote-app", line 8, in <module>
sys.exit(main())
File "/home/bfg/.local/lib/python3.8/site-packages/mpv_remote_app/__init__.py", line 99, in main
ms.run(daemon=args.daemon)
File "/home/bfg/.local/lib/python3.8/site-packages/mpv_remote_app/media_server.py", line 53, in run
self._serve(self._recv())
File "/home/bfg/.local/lib/python3.8/site-packages/mpv_remote_app/media_server.py", line 207, in _serve
if ack: self._ack(ret, msg)
File "/home/bfg/.local/lib/python3.8/site-packages/mpv_remote_app/media_server.py", line 127, in _ack
self.sock.sendto(response, self.client)
OSError: [Errno 90] Message too long
It would be nice to have any controllers connected to the server stay in sync when one changes state.
This requires:
It will require a lot of work and at this point is low priority.
add setting in menu to choose which audio track to use
I'm a PhD student interested in finding security vulnerabilities in open source projects.
We found a total of 04 warnings (indicating potential vulnerabilities) when running the CogniCrypt static analyzer (*) on mpv-remote-app(or its library dependencies). We documented each one of these issues in private gists for the sake of confidentiality (non-disclosure).
Can you please let us know whether we can share these gists with you? We are eager to evaluate the perception of developers (e.g. severity of these warnings) and improve mpv-remote-app's security, and the quality of the reports of static analysis tools.
Either a scrubber or a "jump to" form.
This is mostly semantic and does not affect compilation but the directory structure uses miccah.laptopremote
but source java files, and the manifest uses miccah.mpvremote
in their package
name declarations. This makes some symbols in the editor appear as unresolved, or be displayed with a full path i.e. miccah.mpvremote.Settings
.
Add an X
or square (stop) button to "quit" mpv. This will send the stop
command which will stop playback and close the video, but the player will remain in an idle state (ready for a loadfile
)
If server starts own mpv instance, even with using '-r path/to/media', hitting library in app results in nothing. I can see the server is "browsing" the path, but app doesn't display anything. So no control possible :-(
Provide a way to give feedback in the application. (No popups!)
add setting in menu to choose which subtitle track to use
The --daemon
flag works and will fork a new process, however to kill the server requires sending a kill signal to that PID.
The way to do this is not very user friendly, so I need to consider writing another application to communicate with the server when it is a daemon.
i have installed this app on my phone and computer and the next step says run the server, but i am a bit confussed as to how, is it a programm or a command line?
Hey,
it would be great if the app could remember the last host, port and password used when it's opened. Also, being able to use a hostname (not just an IP address) would be very convenient, I think. Lastly, the keyboard isn't auto-closed when you leave the menu, which overlaps the player controls.
Thanks a lot!
this section of server.py
is prone to attacks
# Authenticate
if auth(data, server_password) == False:
if json.loads(data["message"])["command"] != "health":
continue
a malicious user could exploit the json interpreter after the auth fails
a better approach would be to have the health
command be a raw request instead of wrapped in an HMAC (e.g. health
instead of {'time': ...., 'message': '{"command": "health"}'}
)
this way, we can check if the string data == "health"
before we authenticate
Currently seek is implemented by repeating a small seek command (e.g. seek 5
). This makes the playback jumpy and is especially noticeable in the audio.
It would be a better experience to have smoother seek functionality.
Create setting option for playback speed (e.g. 1.1x
)
Hi @mcastorina, I'm having a hard time running the server tests... Here's the output that I get. Am I missing some configuration?
$ make test
python3 -m unittest discover tests
E
======================================================================
ERROR: setUpClass (test_media_server.TestMediaServer)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/marcomarra/git/mpv-remote-app/server/tests/test_media_server.py", line 18, in setUpClass
cls.server.run(daemon=True)
File "/home/marcomarra/git/mpv-remote-app/server/mpv_remote_app/media_server.py", line 47, in run
self.open()
File "/home/marcomarra/git/mpv-remote-app/server/mpv_remote_app/media_server.py", line 42, in open
self.sock.bind((self.address, self.port))
socket.gaierror: [Errno -2] Name or service not known
it is currently the default android icon
two most common platforms
https://wiki.archlinux.org/index.php/Creating_packages
https://askubuntu.com/questions/16446/how-to-get-my-software-into-ubuntu
Checked out, pip install requirements, start mpv as stated in Readme, but server.py doesn't recognize the running instance and starts its own. So no control of running instance possible
If server starts own mpv instance, even with using '-r path/to/media', hitting library in app results in nothing. I can see the server is "browsing" the path, but app doesn't display anything. So no control possible :-(
Hello,
How to do Android-to-Android control ?
Thanks
add --daemon option to run the server in the background
Related to feature #58
Oftentimes, the wrong yt video is played when a link is shared from another app. This seems to occur when the video code contains non alphanumerical characters.
Moreover, #58 enforces parsing a URL using ytdl:// protocol, which is restrictive, since videos can be streamed from multiple sources, not just yt. Therefore, playing a video from URL should be made general, without assuming yt to be the source.
I was using peerflix and follow the instructions step by step but when i want to click on the button play appear a message failed.
IP Address: localhost
Port: 88888
Password: p4ssw0rd
Settings panel resets settings on phone orientation change.
mpv-remote
version 0.0.3, Android 11.
Steps to reproduce:
Settings
and fill in any field;Expected behaviour: settings are saved.
Actual behaviour: settings are reset to defaults.
currently I am simply passing whitelisted commands straight to the IPC server, but it would be a good idea to use a standard messaging protocol
either document the messaging protocol or adhere to a current standard
make the speed of FF / RW be a function of time the button is held (i.e. the longer you hold the button, the faster it goes)
FAILURE: Build failed with an exception.
* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/7.5.1/userguide/gradle_daemon.html
Process command line: /usr/lib/jvm/java-8-openjdk-amd64/bin/java --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED -Xmx2048M -Dfile.encoding=UTF-8 -Duser.country=GB -Duser.language=en -Duser.variant -cp /opt/gradle/versions/7.5.1/lib/gradle-launcher-7.5.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 7.5.1
Please read the following process output to find out more:
-----------------------
Unrecognized option: --add-exports=java.base/sun.nio.ch=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Could you please take a look? Thanks!
Add mute button next to volume slider
[X] ---------o------
Currently each directory change in the library will ask the server for the files. Caching this data will give better performance and user experience.
Hello,
I just made this work and it's working surprisingly well so far. Thanks for making this!
There are a couple of buttons I would like to request, which are useful:
Thanks a lot!
PS: Maybe it's even a good idea to directly proxy mpv's ipc json format (with auth, and blacklist (for e.g. run
command) added on top of course), instead of translating all commands on software? This way the Android software just needs to send the correct JSON, with no modifications to the server needed to add new commands.
I set the following into ~/.config/mpv/mpv.conf
:
input-ipc-server=/tmp/mpvsocket
This is equivalent to starting mpv with the --input-ipc-server=/tmp/mpvsocket
cmd argument, but the server script doesn't indentify as such, and start a new instance.
If this is solved, i think it's possible to set up the server as a script to start along with mpv in a very transparent way.
Would you mind it if I fork your project but rewrite it completely?
I want to possibly ditch the Python sever and extend/modernize the user interface a lot?
Otherwise I'd use the project as inspiration and write my own from scratch.
Asking this here, because there's no other way to reach you.
Invoking make build
after a fresh clone fails with the following error:
python3 -m build
/usr/bin/python3: No module named build
make: *** [Makefile:13: dist] Error 1
The reason seems to be in the dist
dependency of the make recipe of build
:
mpv-remote-app/server/Makefile
Lines 12 to 13 in 7e777fd
dist
recipe should probably be something like:
$(PYTHON) setup.py sdist bdist_wheel
So the dist
recipe should be fixed, if it serves a different purpose than build
.
Add a playlist feature to queue videos
server.py
is all over the place with functions and global variables. this should be rewritten for better readability, extensibility, and maintainability
I've noticed there are several irrelevant/unutilized resources like:
side_nav_bar.xml
,
all ic_menu_*.xml
file.xml
,
folder.xml
activity_main_draw.xml
Also, in my opinion, SettingsAdapter.java
should be re-coded as it's very inflexible if one wishes to add new views to the sidebar or set custom properties to them.
It seems that non-ASCII filenames cause some trouble to the server - example debug output:
DEBUG:root:Received: "{"message":"{\"time\":1555279337058,\"command\":\"play\",\"path\":\".\\\/ττ.mkv\"}","hmac":"b66d4189c5170c1b274e8115f7622edb"}"
INFO:root:Authentication failed for command: "{'message': '{"time":1555279337058,"command":"play","path":".\\/ττ.mkv"}', 'hmac': 'b66d4189c5170c1b274e8115f7622edb'}"
Can't browse non-ASCII directories, either:
INFO:root:Received command: "{'time': 1555279609126, 'directory': '.', 'command': 'list'}"
DEBUG:root:Sending ACK: "{"action": 1555279609126, "time": 1555279598434, "result": true, "message": {"directories": ["\u03c4\u03b5\u03c3\u03c4", "test"], "files": []}}"
DEBUG:root:heartbeat
DEBUG:root:Received: "{"message":"{\"time\":1555279609962,\"directory\":\".\\\/τεστ\",\"command\":\"list\"}","hmac":"dba7c18b31dbcae8fb505d98acd1b15a"}"
INFO:root:Authentication failed for command: "{'message': '{"time":1555279609962,"directory":".\\/τεστ","command":"list"}', 'hmac': 'dba7c18b31dbcae8fb505d98acd1b15a'}"
Running with Python 3.7.3 under Gentoo Linux.
Thanks!
this project is called "mpv-remote-app" but support for other media players might be useful
use the app to start streaming content from a website (e.g. youtube)
I think a good place to start is to allow custom urls so the user can browse youtube, then copy and paste the link into the mpv remote app
instead of directly printing (using print
), use the logging library and include --verbose
flags
As mentioned in #14, the file list doesn't seem to work for symlinked directories. e.g. you symlinked /home/you/data
to /mnt/data/
, then when you browse /home/you/data
it shows up as empty.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.