Skip to main content
Participant
August 16, 2012
Question

How to playback a video recorded inside of an AIR for iOS app (using native recorder)

  • August 16, 2012
  • 4 replies
  • 1354 views

This is a very simple question. Really looking for a yes or no answer here.

Can you payback a video previously recorded on an Air for iOS app?

No problems with this functionality on Android, but apparently there is no information on how to simply playback a video that you know the exact path to on iOS. I am stunned at the lack of information here.

*Not interested in browsing to the Video...although I understand the CameraRoll browsing is not supported anyway.

**I have the exact path the video, as provided by the mediaCompleteHandler, shown below.

private function mediaCompleteHandler(e:MediaEvent):void

{

     //this is how we know the relative path to the recorded file (.MOV)

   _recordedFile = e.data.file;

}

The path to this file is not a question. Sucessfully getting a handle on that file is another story.

example path:

"/private/var/mobile/Applications/70518860-FB6D-4E99-AF4E-D2010C5B384C/tmp/capture/capturedvideo.MOV"

Have tried using various combinations of File.documentsDirectory, File.ApplicationDirectory, File.ApplicationStorageDirectory, and File.userDirectory to wrap this string into a meaningful File Reference

Nothing seems to work. Error =

"The requested URL was not found on this server."

Any help would be greatly appreciated.

This topic has been closed for replies.

4 replies

Known Participant
November 13, 2012

Did you ever manage to figure this out? I also get back the data OK and it reflects exactly what you're saying above but it must not be in H264 format or something because even though I try and play it.. it just doesn't do anything.

I wish Adobe would post these two tutorials on their AIR dev site:

- How to capture video, play it back and save it to installDir

- How to capture audio, play it back and save it to installDir

Sigh...

Any help would be appreciated.

Inspiring
August 16, 2012

So are you recording use a native extension but trying to play back using AIr?

Air can only really playback VP6 format which is an FLV. For MOV you would need to use the native player in order to playback a .MOV file which there are two areas for: StageWebView which is simple but you have no programmatic control over, or you write a native extension and use UIWebView which is complicated. If you search the forums for UIWebView you'll find a guy that wrote an ANE for the native player which is only around $100 I think however ANE's are very version specific these days.

Also if you go with StageWebView you have to send it a hackish string to load a local file. Someone listed it out in another forum post so I'd search for StageWebView and see what you can find.

One of the main reasons you don't see other formats supported is AT&T didn't want large movie files to be downloaded so they really only support streaming video formats and even FLV's are not allowed to be played longer then 5 minutes on your carrier connection. It's why Apple came out with multi bitrate HLS which is a very mobile friendly H.264 encoded streaming video format. Although I with Apple would just cut the bs and support HDS so we dont' gotta deal with multiple http streaming protocols.

The reason you don't see much support for video is 2 reasons. 1.) When you start talking video you start talking streaming and that's something that can take years to get you head around especially live unless you working for a company that's leading in it or you have a few million dollars in funding to pay people to figure it out. 2.) The players in the industry who know what they are doing are keeping it tight lipped because it's a highly f'in profitable industry and we want to keep it that way.

Even though the quality is lower I'd recommend using Air to record as well as playback.

Participant
August 16, 2012

(thanks for jumping in here Pete!)

"So are you recording use a native extension but trying to play back using AIr?"

No, but I want to be careful with that response.

I am using the AIR sdk to start whatever the native Video app is on the given platform (as shown below)...that said, this is probably still a native extension that is baked into the AIR sdk. So, to reiterate, I did not create my own native extension for this. No need. But there is most likely still an Adobe Native Exension in play here.

var cameraUI:CameraUI = new CameraUI();

      cameraUI.addEventListener(MediaEvent.COMPLETE, mediaCompleteHandler);

      cameraUI.launch(MediaType.VIDEO);

The mediaCompleteHandler (as you probably already know) will let me know where the resultant file is located after recording is complete - in whatever format it may be. No issues here.


As I mentioned, this is very straightforward on Android, but of course the file format is different there. Once the video is done recording, I tell the stageWebView to play the file in the CameraUI callback. Simple stuff.

"Also if you go with StageWebView you have to send it a hackish string to load a local file. "

I am in fact already using a StageWebView implementation.

es.xperiments.media.StageWebViewBridge

The project in question is using Flare3D as well, and apparently we are not able to use both StageVideo (our original intent) and Flare3D in the same project without issues.

Basically, the code is pulling in a stagewebview, and using the webkit browser to load the video natively into the application. I would expect this would not have problems playing an .MOV....but again, I do not even get that far.

Basically I get a 404 error - I am not getting a file format error.

So am I hearing that this is a limitation of AIR on iOS?
*Note sure a 3rd party lib is going to get me around the 404 error....

Known Participant
November 12, 2012

I saw somewhere that someone said if they prepended "File:///" onto the path it worked. Here's the link:

http://stackoverflow.com/questions/9084155/save-video-in-applicationstoragedirectory-on-ios (look at the answer that got voted up.)

Hope it helps