jeudi 30 mars 2017

Using AIR and AS3 to Launch VLC on Android

I'm working on an app for a client that is a one stop shop for their latest product videos. It will download the latest videos posted online, organize them into categories, and then allows the user to select videos to add to a VLC playlist. This is all working perfectly. However, the last piece of the puzzle is opening the VLC playlist using Adobe AIR directly. Here is my code:

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=http://ift.tt/2oC9KBm;" +
              "end");                 // The intent string
navigateToURL(new URLRequest(url));   // Navigates to the app

The only caveat is that I don't know how to get the proper component information for VLC or how to get the playlist to start playing. The original code for the intent section directed towards the Settings screen, which worked, but I can't get it to launch any other app.

Aucun commentaire:

Enregistrer un commentaire