Skip to main content
November 2, 2012
Answered

StageVideo doesn't play downloaded content, but will play included content. (iOS)

  • November 2, 2012
  • 2 replies
  • 1659 views

Hi all,

I'm working on an app, and am trying to use StageVideo and I've come across a problem.

I'd like the app to be able to play H.264 videos on iOS.

The video content that needs to be played will be downloaded by the app from our server to the device.

I've run my code on windows and android (specifically a xoom) and it works, so I know that the files are being downloaded and file paths are correct. However, when running the code on iOS I wasn't seeing any video or hearing any sound.

I then tried including the video file when making the ipa and playing it from the included location and it plays with video and sound.

Can anyone think of a reason that the video file won't play if it's been downloaded as opposed to being included with the app?

Including video files isn't an option as they will change regularly, so need to be downloaded.

Thanks,

Chris

P.S. I can post some code if you need it, but I've pretty much followed this code:

http://forums.adobe.com/message/4352118

which gets loaded in an empty view.

This topic has been closed for replies.
Correct answer

Thanks both for your help.

I got it working. My problem was that the app was creating the local file using our server's address e.g. "video/1100", which I knew was a video, so I'd pass that into the StageVideo which wouldn't know what to do with it. The solution was to append ".mp4" to the end of the file location e.g. "video/1100.mp4" so that StageVideo could open it.

When I embedded it with the app, I was using the original file which was called "example.mp4", so it wasn't having that problem.

As an aside, I've ended up going with StageWebView for my solution, as it's easier to design my app around having a video in the forground than requiring a gap through everthing to the background.

(StageWebView also has the problem I found above where it requires a file extension to play).

2 replies

Correct answer
November 5, 2012

Thanks both for your help.

I got it working. My problem was that the app was creating the local file using our server's address e.g. "video/1100", which I knew was a video, so I'd pass that into the StageVideo which wouldn't know what to do with it. The solution was to append ".mp4" to the end of the file location e.g. "video/1100.mp4" so that StageVideo could open it.

When I embedded it with the app, I was using the original file which was called "example.mp4", so it wasn't having that problem.

As an aside, I've ended up going with StageWebView for my solution, as it's easier to design my app around having a video in the forground than requiring a gap through everthing to the background.

(StageWebView also has the problem I found above where it requires a file extension to play).

Legend
November 2, 2012

Is that format supported on iOS? Compiling internally may include things that iOS blocks.

November 2, 2012

The as3 docs suggests that it is, but with limited functionality:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html

Legend
November 2, 2012

Huh.

Ok, if you found that, then you probably found this as well:

Special considerations for H.264 video in AIR 3.0 for iOS

For H.264 video, the iOS APIs for video playback accept only a URL to a file or stream. You cannot pass in a buffer of H264 video data to be decoded. Depending on your video source, pass the appropriate argument to NetStream.play() as follows:

  •   For progressive playback: Pass the URL of the file (local or remote).
  •   For streaming video: Pass the URL of a playlist in Apple's HTTP Live Streaming (HLS) format. This file can be hosted by any server; Flash Media Server 4.5 and higher has the advantage of being able to encode streams in HLS format.

Sorry, can't be much help. I do know that with Android, I had some problems with a custom OSMF element and StageVideo as OSMF had reset the scaleX and scaleY values of the display clip to something daft. Setting scaleX = scaleY = 1; seemed to fix that, but I don't think this is the same as you aren't getting sound where I was.

G