ywzhaiqi / userChromeJS

我原创或修改或自用的 userChromeJS 脚本
337 stars 190 forks source link

ExternalVideoPlayer.uc.js 求教 #9

Closed iMyon closed 10 years ago

iMyon commented 10 years ago

请问这个脚本有办法在打开视频的同时同时加载外部字幕么? 如果可以的话,假设字幕路径为path,要怎么调用? 刚接触uc脚本,尝试阅读源代码,但是由于水平不够加上脚本的注释太少没看明白。 thx.

ywzhaiqi commented 10 years ago

这个要看播放器是否支持。我这个脚本是通过生成一个播放列表文件,然后传递路径给播放器。

如果播放器支持,可以把参数放入 args 传入

args.push("/a");
args.push(path);

var process = Instances.process;
process.init(player);
process.runAsync(args, args.length);
wenketel commented 10 years ago

勤奋的猫酱

iMyon commented 10 years ago

("▔□▔)/忙里偷闲罢了

2014-06-06 12:59 GMT+08:00 文科 notifications@github.com:

勤奋的猫酱

— Reply to this email directly or view it on GitHub https://github.com/ywzhaiqi/userChromeJS/issues/9#issuecomment-45303098.

wenketel commented 10 years ago

那么你懂了么 坐等直接播放视频+弹幕的b站脚本出现

iMyon commented 10 years ago

还没开始测试,今天忙了一天,先补睡一觉再说

2014-06-06 16:33 GMT+08:00 文科 notifications@github.com:

那么你懂了么 坐等直接播放视频+弹幕的b站脚本出现

— Reply to this email directly or view it on GitHub https://github.com/ywzhaiqi/userChromeJS/issues/9#issuecomment-45314400.

iMyon commented 10 years ago

感谢,回头试试pot行不行,到时候可能还会回来请教^_^

2014-06-06 1:55 GMT+08:00 ywzhaiqi notifications@github.com:

这个要看播放器是否支持。我这个脚本是通过生成一个播放列表文件,传递给播放器。

如果播放器支持,把参数放入 args 传入

var process = Instances.process; process.init(player); process.runAsync(args, args.length);

— Reply to this email directly or view it on GitHub https://github.com/ywzhaiqi/userChromeJS/issues/9#issuecomment-45252433.

iMyon commented 10 years ago

果然又有问题了,用的mpc-hc测试


args.push("/sub");
args.push("\"G:\\桌面\\1.ass\"");
alert(args.join(" "));
var process = Instances.process;
process.init(player);
process.runAsync(args, args.length);

然后输出的信息是这个
C:\Users\MoeMyon\AppData\Local\Temp\externalVideoPlayer-76.asx /sub "G:\桌面\1.ass"
可以启动视频但是字幕没出来,命令行没有问题
mpc-hc.exe "G:\桌面\09.mp4" /sub "G:\桌面\1.ass"

ywzhaiqi commented 10 years ago

改用这个方法试试,原方法可能是因为路径中的中文问题。

process["runw" in process ? "runw" : "run"](false, args, args.length);

https://developer.mozilla.org/zh-CN/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIProcess#runw()

void run(
  in boolean blocking,
  [array, size_is(count)] in string args,
  in unsigned long count
);

void runw(
  in boolean blocking,
  [array, size_is(count)] in wstring args,
  in unsigned long count
);

string 和 wstring

iMyon commented 10 years ago

nice~成功了。非常感谢!