How to pass parameter in a link to open VLC?

 ̄綄美尐妖づ 提交于 2019-12-11 04:11:37

问题


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.


回答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):

  • LibVLC: https://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc.html
  • How to Use VLC Media Player API in a C Program: https://progur.com/2017/06/how-to-use-vlc-api-in-c.html
  • VLCJ -- Java framework for the VLC media player: https://github.com/caprica/vlcj
  • Node.JS -- VLC API: https://github.com/jfhbrook/node-vlc-api .Net
  • Interface to VLC: https://wiki.videolan.org/.Net_Interface_to_VLC
  • PHP/Python/Perl options -- Linux control a running vlc process through command line: Linux control a running vlc process through command line

  • No code option, just use the basic web interface that comes with VLC: https://www.howtogeek.com/117261/how-to-activate-vlcs-web-interface-control-vlc-from-a-browser-use-any-smartphone-as-a-remote/



来源:https://stackoverflow.com/questions/52473966/how-to-pass-parameter-in-a-link-to-open-vlc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!