我需要在我使用Flash Professional CC为iPad构建的小应用程序中显示.mp4文件。最好的方式是StageWebView,但我不能让它工作。我找到了一些应该做的技巧,但我不断收到错误:1180:调用可能未定义的方法文件。
有人可以帮我一点吗?
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");
答案 0 :(得分:0)
您可以在iOS中使用stagewebview播放.mp4视频。按照以下步骤进行操作。
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
如果文件在app本地商店中,
例如:
[app_name] / Local Store / video.mp4
var videoFile : File = new File( File.applicationStorageDirectory.resolvePath( video.mp4 ).nativePath;
var path : String = ( videoFile.exists ) ? videoFile.url : "";
注意:
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/");