使用 AIR 和 AS3 在 Android 上启动 VLC



我正在为客户开发一个应用程序,该应用程序是他们最新产品视频的一站式商店。它将下载在线发布的最新视频,将它们组织成类别,然后允许用户选择要添加到 VLC 播放列表的视频。这一切都完美地工作。但是,拼图的最后一块是直接使用Adobe AIR打开VLC播放列表。这是我的代码:

var fs:FileStream=new FileStream();   // Creates a new filestream
var path:String=File.userDirectory.resolvePath($fle).nativePath;  // Creates the playlist path
var file:File=new File(path);         // Creates the file
try{fs.open(file,FileMode.WRITE);}    // Opens the file to write the data
catch(error:Error){}
fs.writeUTFBytes(outputStr);          // Writes the data
fs.close();                           // Closes the filestream
//file.openWithDefaultApplication();  // I found out this doesn't work with Android systems
var url:String = ("intent:#Intent;" +
"action=android.intent.action.MAIN;" +
"category=android.intent.category.LAUNCHER;" +
"component=org.videolan.vlc/.AppEntry;" +
"end");                 // The intent string
navigateToURL(new URLRequest(url));   // Navigates to the app

唯一需要注意的是,我不知道如何获取VLC的正确组件信息或如何让播放列表开始播放。意图部分的原始代码指向"设置"屏幕,该屏幕有效,但我无法让它启动任何其他应用程序。

更新:我已经能够启动VLC,播放使用此页面作为参考播放的最后一个视频: https://wiki.videolan.org/Android_Player_Intents/

下面是更新的网址请求字符串:

var url:String = ("intent:#Intent;" +
"action=android.intent.action.MAIN;" +
"category=android.intent.category.LAUNCHER;" +
"component=org.videolan.vlc/org.videolan.vlc.gui.video.VideoPlayerActivity;" +
"end");

这将启动VLC并播放上次播放的视频。但是,我希望它播放指定的播放列表。

一个很好的做法是 ANE,空气原生扩展, ANE 允许您执行本机(android 或 ios 或 ...)代码 因此,您有更多选项来运行VLC和访问其属性

如果你对ANE开发有任何问题,也请阅读它
,让我知道改进这个答案,我认为你对Java端编程没有问题

最新更新