Closed vankasteelj closed 7 years ago
Ok I found the problem. The missing "path" in the status object got me in the right way : I must use absolute paths, all the time, nothing relative.
Maybe that's worth adding in the docs, like changing:
mpvPlayer.loadFile("/path/to/your/favorite/song.mp3");
to
mpvPlayer.loadFile("/absolute/path/to/your/favorite/song.mp3");
Heyho :)
Where do you have to use absolute paths? To load the file? I always used relative paths so far and that worked just fine.
The problem could be, that your path starts with a /. That refers to the linux root directory. As a relative path it would either be test/file.mkv
or ./test/file.mkv
.
But since you're on Windows, shouldn't it be test\file.mkv
anyway? (sorry I don't have much of a clue about Windows)
It says in the docs Provides the absolute path to the file or the full url of a stream
by the way.
I must have misread then. On windows with node, you usually use /
or \\
I see thanks for the info. It should really work with relative paths thought. On MacOS and Linux it does at least. Have you tried with test/file.mkv
instead of /test/file.mkv
?
The statusobject will always give you the absolute path, but you should be able to insert a relative one.
apparently I can't, my snippet is located in <appfolder>/app/main.html
(nwjs app), and the video file is <appfolder>/app/test/file.mkv
edit: ok, somehow it decides that the PWD is <appfolder>
for no obvious reason.
so mpvPlayer.loadFile('app/test/file.mkv');
does work
Glad it works for you.
On Unix you can go up one directory by using ..
. Thus ../../foo/bar
would go two directory up and then enter foo and bar. Might work on Windows, too.
It works that way too, but it's buggy sometimes. Windows is a pain, but it also has directx and i'm too lazy to reboot everytime, so I end up using Windows most of the time
I think here the issue is more with nwjs, but why would it sometimes chose the actual file as PWD, sometimes the app root, that I don't know
Hi, I'm trying out your api wrapper, but I can't seem to make it load anything. The player doesn't even open.
Here's the code :
And here's the console output :![nw_2017-07-03_14-49-37](https://user-images.githubusercontent.com/12599850/27793550-d4962fdc-5ffe-11e7-8e52-37df949b1159.png)
The file can be read by mpv, it works fine when using outside the js env, with clicking and drag&dropping and other boring stuff