How to display StageWebView page in .ipa app from Flash Professional

101 Views Asked by At

I need to display a .mp4 file in a small app that I am building for the iPad with Flash Professional CC. The best way looks to be StageWebView, but I cant get this to work. I found some code that is supposed to do the trick but I keep getting errors: 1180: Call to a possibly undefined method File.

Can anyone please give me some help with this?

var webView = new StageWebView();
webView.stage = this.stage;
webView.viewPort = new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight);
var path:String = new File(new File("app:/path/file.html").nativePath).url;
webView.loadURL("app:/path/file.html");
1

There are 1 best solutions below

0
Gopinath Ravichandran On

You can play the .mp4 video using stagewebview in iOS. Follow the below steps to get works.

    var webView = new StageWebView();
    webView.stage = this.stage;
    webView.viewPort = new Rectangle( 0, 0, stage.stageWidth,   stage.stageHeight);
    var videoFile : File = new File( File.applicationStorageDirectory.resolvePath( "/enter/the/file/path/here" ).nativePath ); //Make sure your .mp4 is located in local store.

    if( videoFile.exists ) //To check file is exist or not
        webView.loadURL( videoFile.url ); //Here given .mp4 file will play using ios native player
  • if files is in app local store,
    Eg: [app_name]/Local Store/video.mp4

    var videoFile : File = new File( File.applicationStorageDirectory.resolvePath( video.mp4 ).nativePath;
    var path : String = ( videoFile.exists ) ? videoFile.url : "";
    

Note:

Application Directory = File.applicationDirectory.resolvePath("file/path/application/directory");
Documents Directory = File.documentsDirectory.resolvePath("file/path/in/documents");
User Directory = File.userDirectory.resolvePath("path/from/user/");