通过HTML / JS或PHP中的VLC打开文件 [英] Open file in VLC via HTML/JS or PHP

查看:260
本文介绍了通过HTML / JS或PHP中的VLC打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个本地媒体服务器,纯粹是为了教育的目的,
并希望通过浏览器(preferably铬)

I'm trying to set up a local media server, purely for educational purpose, and want to open local video files in VLC media player via the browser (preferably Chrome)

到目前为止,我已尝试以下没有任何运气:

So far I've tried the following without any luck:

本地的file:///的网址:能够在Windows资源管理器中打开本地目录
但在他们指定的程序(使用IE11)。没有运气打开媒体文件

local "file:///" URLs: was able to open local directories in windows explorer but no luck opening media files in their designated programs (using IE11).

如果通过浏览器通过命令行(PHP my_file.php)中运行,但不是这工作:
    

This works if run via command line (php my_file.php), but not via browser:

$file = 'pathToFile';
system("pathtovlc/vlc {$file}");

结果
通过运行PHP .bat文件,反过来调用VLC命令行不工作,要么


Running a .bat file via PHP that in turn calls the VLC command line doesn't work either

在最后,通过命令行直接打开文件,或者通过CLI使用PHP,
就像一个魅力,但我还没有找到一种方法,成功地打开一个文件通过浏览器。

In the end, opening files directly via the command line, or using PHP via the CLI, works like a charm but I havent found a way to open a file successfully via the browser.

我假设它是一个用户权限问题作为Apache服务使用系统中运行
权限,但我似乎无法找到一种解决方法。我读到有关运行的Apache
服务具有管理员权限,但我无法找到如何把这事办成。

I'm assuming it's a user permission issue as the apache service is run using system permissions, but I can't seem to find a workaround for this. I read about running the apache service with administrator permissions but I'm not able to find how to actually pull this off..

任何输入大大AP preciated!

Any input is greatly appreciated!

== ==编辑

我试图通过PSEXEC运行VLC命令,但没有luck..the命令运行,如:

I tried to run a VLC command through psexec, but no luck..the command was run like:

exec('path_to\psexec -u myUsername -p myPassword -c ^path_to\vlc.exe 
path_to\media_file');

这再次通过命令行的伟大工程,但不是通过浏览器。

Again this works great via command line, but not via the browser..

编辑== == 2
结果
结果
因为有必然是从一个网页浏览器内的在他们指定的程序中打开媒体文件的方式仍然摆弄周围与此有关。

== EDIT 2 ==

Still fiddling around with this as there's bound to be a way to open media files in their designated program from within a webbrowser.

现在阿帕奇具有管理员权限,但仍然没有运气得到这个工作!
结果
结果
编辑== == 3
结果
结果
我在Chrome和Firefox的扩展locallinks左右摆弄,这让我远一点。
开幕< A HREF =文件:///路径>链接< / A>只需点击它在Chrome中所做的工作链接,但导致问题铬总是下载文件(即使它们是本地)而不是仅仅在他们指定的程序中打开它们。

Apache now has administrator rights but still no luck getting this to work!

== EDIT 3==

I fiddled around with the locallinks extension in Chrome and Firefox and this got me a bit further. Opening <a href="file:///path">link</a> links by simply clicking on it did work in Chrome, but resulted in the problem of chrome ALWAYS downloading files (even if they're local) instead of just opening them in their designated program.

对于Firefox,扩展工作,但它需要一个右键 - > locallinks - >打开,这似乎是确定,但我真的找一个点击的解决方案

For firefox, the extension worked but it requires a right click -> locallinks -> open, which seems ok but I'm really looking for a one click solution.

在VLC直接打开一个文件(比如说一个MKV文件)通过本地.html文件在Firefox完全正常,但是当通过HTTP提供://。我改变了对Firefox的security.fileuri.strict_origin_policy设置:config来假的,这让我打开本地文件:///的URL甚至通过HTTP,但出于某种原因,它去掉从文件URI的末尾,这意味着它的文件名指向目录中的文件中,而不是文件本身..令人沮丧的,至少可以说

Opening a file directly (say an .mkv file) in VLC works perfectly fine in Firefox via a local .html file, but when served over http://. I changed Firefox's security.fileuri.strict_origin_policy setting in about:config to false, which allows me to open local file:/// URL's even via HTTP, but for some reason it strips the filename from the end of the file URI which means it points to the directory the file is in and not the file itself.. frustrating to say the least

推荐答案

在我得到它的方式,我可以点击一个文件URL工作(仅在Firefox)结束,该文件被打开火狐之外的指定的程序。

In the end I got it working (solely on firefox) in a way that I can click a file URL, and the file is opened outside of firefox in the designated program.

原来,这设置security.fileuri.strict_origin_policy设置为false,capability.policy.default.checkloaduri.enabled到allAccess和禁用Firefox的插件VLC一切都是有它!

Turned out that setting the security.fileuri.strict_origin_policy setting to false, capability.policy.default.checkloaduri.enabled to allAccess and disabling firefox's vlc plugin was all there was to it!

我还没有找到一个解决浏览器兼容性,甚至没有通过PHP的管理员级别执行的命令,但我有种放弃希望!

I still haven't found a crossbrowser solution, not even with commands executed via PHP on an administrator level, but I kind of gave up hope!

这篇关于通过HTML / JS或PHP中的VLC打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆