I want access a local video file with my app and launch it in the native player. I tired including the movie.m4v file in the app and launching it with: navigateToURL(new URLRequest("movie.m4v")); but it does not work. Is there a way to launch a local video file?
I rewrote the AS per the development and I can get it work with email, phone, etc, but still not a local movie file:
import flash.net.*;
import flash.events.MouseEvent;
video_btn.addEventListener(MouseEvent.CLICK, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
var str:String = "movie.m4v";
var urlReq:URLRequest = new URLRequest(str);
navigateToURL(urlReq);
}
hi Guys!
I have the same problem...
here is my code:
import flash.net.*;
import flash.events.MouseEvent;
video_btn.addEventListener(MouseEvent.CLICK, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
var str:String = "movie.m4v";
var urlReq:URLRequest = new URLRequest(str);
navigateToURL(urlReq);
}
I also tried with app:/ (app:/lipton.m4v) but it opened the video only in printCentral (which is not good). When i deleted printcentral it's not opening at all...
any luck on your side guys?
thanks,
Ann
Same problem here.
I want to access the .h264 video within my application directory. "naviagateToUrl" seems not to work within the application directory. This has nothing todo with the file type. Even a simple .html can't be accessed.
Of course it's not a problem to access files from the internet.
@ChoosingNamesCanBeSoXXX: This is confusing since I'm testing on two devices:
- iPhone 3GS with iOS 4.1
- iPad with iOS 3.2.2
Which iOS is running on your iPad? I think it must be the same version?
Maybe you could paste here your few lines of code or your complete test-setup?
Well, I invested even more time but to me it seems like navigation requests within the app-directory simply fail. No errors will be thrown, nothing happens.
So please Adobe, give us at least some feedback.
Quick update: As I mentioned on my blog I can't access any file type within my application directory. So there might be some restrictions?
Heya,
@ChoosingNamesCanBeSoXXX: This is confusing since I'm testing on two devices:
- iPhone 3GS with iOS 4.1
- iPad with iOS 3.2.2
Which iOS is running on your iPad? I think it must be the same version?
Maybe you could paste here your few lines of code or your complete test-setup?
Well,
I invested even more time but to me it seems like navigation requests
within the app-directory simply fail. No errors will be thrown, nothing
happens.
Sadly I can't tell u the current version, since I don't have it around me right now. (Will check later)
Tested and working Code for iPad: (test_btn and status_txt already on stage)
import flash.filesystem.File;
import flash.events.MouseEvent;
var file:File;
var urlrequest:URLRequest;
function init():void
{
status_txt.text = "app init";
file = File.applicationDirectory.resolvePath("test.mp4");
urlrequest = new URLRequest(file.url);
test_btn.addEventListener(MouseEvent.CLICK, spam);
}
function spam(evt:MouseEvent):void
{
status_txt.text = "button spam";
try { navigateToURL(urlrequest); }
catch (e:Error)
{
status_txt.text = "error: " + e.name + "/" + e.message;
}
}
init();
I tried to work with try and catch for the iPod but as u mentioned no error got thrown here either -___-' I was wondering if it has something to do with the config of the devices, but don't have any for myself to investigate more.
Quick update: As I mentioned on my blog I can't access any file type within my application directory. So there might be some restrictions?
I already tested mp4 and xml-files successfully. =o Do u know, that u have to include the files for publishing? (Just like the Default.png)
Greetings~
Guys. Just read the manual every once in a while. You can't access h264 encoded files or anything else for that matter other than ON2 VP6 codec, the first video that was available for flash. Legal restrictions. Didn't try any of your code, because i'm sure it's good, especially if it works on your machines, and not the iDevice. Again, legal restrictions. Try encoding to ON2 VP6 codec and you should be fine.
Guys. Just read the manual every once in a while. You can't access h264 encoded files or anything else for that matter other than ON2 VP6 codec, the first video that was available for flash. Legal restrictions. Didn't try any of your code, because i'm sure it's good, especially if it works on your machines, and not the iDevice. Again, legal restrictions. Try encoding to ON2 VP6 codec and you should be fine.
Depends on what u trying to do...
The topic was to access a local video in the native player (with navigateToURL), not inside the app iteself. And it works fine on the pc and the iPad.
Devguide:
Video
Only Sorensen video and ON2 VP6 video are supported within an AIR application for the iPhone.
You can use the navigateToURL() method to open an H.264 video outside the application. As the request
parameter, pass a URLRequest object with a URL pointing to the video. The video launches in the video player of the
iPhone.
Greetings~
@Applauz78:
FLV videos with On2 VP6 codec will only play within the Flash application. You can't use navigateToUrl because the nativ app only supports h.264 videos.
Playing Flash internal videos works with locally stored videos delivered within the application directory. Will say it's no problem to play them!
But the internal video performance is really, really bad. I wouldn't use it. On my iPhone 2G even really small video's within a already shipped App from the App store doesn't work good.
That's why it is so necessary to start the native video player for local videos with h.264 encoding.
I really hope Adobe will leave a comment here.
Can I use the Flash Video Component or I must create a custom player ? The app I am workin on will be for iPad.
I really liked the way opening an MP4 performs. It was fast... great quality. I just don't like the usability of exiting the app and making the user have to navigate back to the app.
I also dont know how to save the state of the application so when the user returns they dont have to start all over again ![]()
So .. the playing of video within the app is very limited right now? How about streaming MP3's within the app ?
I couldn't get the FLV playback components to work. I did manage to get it to work using video class, netstream and netconnect:
Here is a sample code for both internal and external.
import flash.net.NetStream;
import flash.net.NetConnection;
import flash.media.Video;
stop();
var vidDisplay:Video = new Video();
vidDisplay.width = 320;
vidDisplay.height = 240;
addChild(vidDisplay);
var nsStream:NetStream;
var ncConnection:NetConnection = new NetConnection();
ncConnection.connect(null);
nsStream = new NetStream(ncConnection);
nsStream.client = this;
vidDisplay.attachNetStream(nsStream);
load_btn.addEventListener(MouseEvent.CLICK, loadVideo);
external_btn.addEventListener(MouseEvent.CLICK, externalVideo);
function loadVideo(e:MouseEvent):void{
nsStream.play("myvideo.flv");
}
function externalVideo(e:MouseEvent):void{
var str:String = "http://your url.com/video/myvideo.mov";
var urlReq:URLRequest = new URLRequest(str);
navigateToURL(urlReq)
}
As mentioned above the internal video option is crap, playback is poor. (although it is a little better after it is viewed once)
You'll note that the external video option launches it in the native player on the iphone but when you click done it doesn't return you to your app, you are stuck in safari and have to restart your app. This is a problem which I can't figure out. Using Xcode you can get it to return to the app using MPMoviePlayerPlaybackDidFinishNotification which is triggered when you hit done.
If anyone has solved this please let me know!
North America
Europe, Middle East and Africa
Asia Pacific
Copyright © 2012 Adobe Systems Incorporated. All rights reserved.
Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy (updated 07-14-2009).