3

It's an HTML page which I use only locally.

I have a link to a video in my HD like this:

<a href="/path/to/myvideo.mp4">Watch video</a>

When clicking it, it launches the video with VLC directly as expected. Now, I'd like to pass parameter inside like the starting time for this video.

In the shell for example you can do:

vlc  /path/to/myvideo.mp4 --start-time=126

And it will launches the video at the 126 second point.

How can I do that with my HTML link? I've tried for example:

<a href="/path/to/myvideo.mp4?start-time=126">Watch video</a>

But it still launches it from the beginning of the video.

ThePhi
  • 2,373
  • 3
  • 28
  • 38
  • Try `Watch video` or `Watch video`. Don't know if either will work, but worth a shot I guess. – Martin Sep 24 '18 at 07:14
  • the first one: it launches the video from the beginning (as if what's after `?` was ignored). And for the second one, it says that it can't find the video `/path/to/myvideo.mp4 --start-time=126` (I've tried to replace the `space` with `%20` but for the same result). Thanks for the try though! – ThePhi Sep 24 '18 at 07:18
  • One question though. Can't you add --start-time=126 to the exe and then link to that? – Martin Sep 24 '18 at 07:19
  • I am on Linux. and it's not possible to create a link to a `sh` file in HTML: clicking on it will trigger a download, not a run of the file – ThePhi Sep 24 '18 at 12:37
  • I mean, you are working from a web directory, right? Can you not have the vlc .exe file on your directory have *--start-time=126* manually added to it? That should work. Then you don't have to parse any link parameters or anything. Unless you are looking for dynamically added start times, then that obviously wouldn't be the correct solution. But if it's static anyways, why not just hardcode it into the .exe itself? – Martin Sep 24 '18 at 12:46

1 Answers1

1

At this point I think you would need to use some kind of server-side wrapper/listener, as I had commented in a related question's old answer, the plugin is not available on modern web browsers anymore.

Depending on how badly you need to control the start time (and if its a thing you need to build into an application) then you could call the VLC HTTP Server via its web API and remote control to scrub the player forward on the user's desktop. If you had some kind of push mechanism in place you could even control that via a regular link on the web.

I would suggest to combine a framework like Pusher for the web controls: https://github.com/pusher/pusher-js

Followed by your choice of backend language to listen over HTTP(S), and remote control VLC via its API (either HTTP or native):

bcmoney
  • 2,889
  • 1
  • 24
  • 30
  • 1
    Thanks! Finally I've used the ` – ThePhi Sep 25 '18 at 19:48
  • Hah yes that's a much better approach! I though for some reason (like a work req.) you HAD to use VLC... had I known you could use HTML5, I'd have stuck to my original suggestion to use HTML5 video https://stackoverflow.com/questions/8138244/open-video-stream-on-vlc-player-through-the-browser from there you have Media fragments (like you used) or full JavaScript API. See these related questions/answers: https://stackoverflow.com/questions/31978594/how-to-play-a-video-from-the-nth-second https://stackoverflow.com/questions/5981427/start-html5-video-at-a-particular-position-when-loading – bcmoney Sep 26 '18 at 13:56