RblSb / SyncTube

Synchronized video viewing with chat and other features (one-channel web service)
MIT License
258 stars 54 forks source link

trying to play local .mp4's "Failed to add video." #25

Closed chia-gesundheit closed 3 years ago

chia-gesundheit commented 3 years ago

When i try to add a local movie.mp4 i get the error "Failed to add video." shown in the chat. I am trying it like this on ubuntu: /home/USERNAME/Downloads/movie.mp4

Do you have to type it in differently?

chia-gesundheit commented 3 years ago

The error doesnt always show, sometimes it only shows with one particular .mp4 and sometimes with all of them and sometimes all of them work. And i always use the same link e.g. /home/USERNAME/Downloads/movie.mp4 (Tripple checked) What could be the reason for this inconsistency? I tried both running Synctube in Docker and with npm.

RblSb commented 3 years ago

I can reproduce this problem with some "bad" paths/names (with spaces or other non-url characters). Probably this is your case?

RblSb commented 3 years ago

Let me know if problem still there.

chia-gesundheit commented 3 years ago

I moved it out of the /Downloads folder into /home/ but it still happens, file names are very simple.mp4, Youtube links are working fine. Its just not adding my .mp4's (eventho sometimes it did). I didnt change anything in the config.

chia-gesundheit commented 3 years ago

I tried it with a new debian VM as well, The .mp4 files are in /home/me/Downloads/video.mp4 and thats exactly what i enter, but it just shows "Failed to add video." in chat.

RblSb commented 3 years ago

Try latest commit. And if this doesn't work please provide your browser name and nodejs versions.

chia-gesundheit commented 3 years ago

Tried latest commit, I tried Firefox and Edge, nodejs is v10.19.0 and npm is v6.14.4 . I use the same copy pasted "link" /home/me/Downloads/ everytime and I dont know how this makes any sense, but sometimes only a random one of my .mp4's is able to play, most of the times not one of them, Right now its 1 out of 5 mp4's that i can add over and over again but the rest will bring errors. Even the same video just a renamed .mp4 filename. I feel cursed. I hope you can still follow weird problem, I can give you access to it or let you try it yourself if you think that helps.

chia-gesundheit commented 3 years ago

At the moment i dont have the problem anymore when i am in a browser locally on the same server. I will do some more testing and report :)

chia-gesundheit commented 3 years ago

I found a fix for my setup, that seems to work. I first have to play the local file while I'm on a browser in the machine thats running SyncTube. Then it will play locally but not for others that are connected from outsite of my network. Then i delete the current video and type the same url (/home/me/Downloads...) but from a browser where im connected from outside the network. Then it works. Thanks for your help and time!

RblSb commented 3 years ago

Yeah, that's for safety, you can add local video files only if you are host (same ip as a server). You can change this line to if (true) { if you want more unsafe behavior, not sure if i should push some option to add local files to playlist even for non-local users.

But as alternative, you can just make symbolic link in SyncTube/user/res/, for example d to /home/me/Downloads, and then local video url /d/Foo.mp4 should work for all clients, if you have that file in Downloads.