Copy link to clipboard
Copied
is it possible to stream video on iPad 2 using either the FLVPlayback component or the Video Class?
i've tried all H.264, Sorenson, ON2 VP6 formats, mp4,m4v,f4v,flv
the videos play OK in the IDE, but on iPad 2 no video shows up
i'm using the Flash 5.5 IDE and AIR 3.2
1 Correct answer
Ok, I created this sample file by tearing some code out of a larger project. Its a little light on comments and the code could be cleaned up a lot but it works fairly well. This example uses stageVideo with a fallback to a regular netstream video object. It is based loosely on several sample stageVideo source that I found online.
When you tap on the play button in the example it first loads in a custom player container, then it converts the entire stage to a bitmap and masks this bitmap using a m
...Copy link to clipboard
Copied
RTMP streams won't work, and FLVPlayback won't play H.264 on iPad. Use a progressive download video, and if you're using FLVPlayback, make it be a regular FLV. If it has to be an H.264 file, then either use the native player, StageWebView, or Netstream.
Copy link to clipboard
Copied
Colin,
thank you for your answer. i can't use the native player or StageWebView in the app i'm working on, but
i was able to play back video by:
a) converting a quick time movie to flv (high quality)
b) using the FLVPlayback
NetStream + H.264 plays back the video but it's too jerky
Copy link to clipboard
Copied
Have you looked into using StageVideo?
Copy link to clipboard
Copied
Jaxim,
yes i looked into using StageVideo
in the documentation for StageVideo there is not even a single line of code...
i used the code i found here http://www.adobe.com/devnet/flashplayer/articles/stage_video.html
but it doesn't work, it throws an error as other people have pointed out
is there a web page with a StageVideo example that works with Flash 5.5?
Copy link to clipboard
Copied
Have you tried downloading the sample source files from that page, and then creating and loading a simple app on your iPad?
Copy link to clipboard
Copied
Keep in mind, much like Stage3D, StageVideo plays below the display list. If you have anything on your display list at all it will show "over" the video. So if you have a background, etc it will completely block the StageVideo.
StageWebView is a good alternative that shows "over" the display list and if encoded in a HTML5 compliant codec (MP4/H264 obviously) it will have controls and fullscreen built in.
Copy link to clipboard
Copied
Try this very helpful for everyone including you..click it right now before its tooo late!!! http://tinyurl.com/7nljbmj
Copy link to clipboard
Copied
Jaxim,
yes, and on this line sv = stage.stageVideos[0]; i get this error: RangeError: Error #1125: The index 0 is out of range 0.
sinious,
i have absolutely nothing on the display list
i can't use a StageWebView in the app, nor a native player
so i'm left with NetStream (unacceptable playback), FLVPlayback (stripped of the VideoEvent is useless), embedding the video on the timeline (which is what i want to avoid) and StageVideo for which i don't have a working example...
Copy link to clipboard
Copied
I have some stageVideo code that I wrote for a video player in an iPad app that I will package up and post for you shortly. The main things are to be sure you are using the version of the AIR SDK that actually supports StageVideo on mobile, making sure your renderMode is set to either gpu or direct and then using the StageVideoAvailabilityEvent.STAGE_VIDEO_AVAILABILITY event to verify that stageVideo is available. It has a iOS themed player UI to make it look like a native player. I am cleaning up my code and post it this evening.
Copy link to clipboard
Copied
Ok, I created this sample file by tearing some code out of a larger project. Its a little light on comments and the code could be cleaned up a lot but it works fairly well. This example uses stageVideo with a fallback to a regular netstream video object. It is based loosely on several sample stageVideo source that I found online.
When you tap on the play button in the example it first loads in a custom player container, then it converts the entire stage to a bitmap and masks this bitmap using a mask bitmap that is created from the library. This mask creates a hole through the bitmap version of the stage contents so that the stageVideo is visible. (Because stageVideo is always drawn under everything in the displaylist.)
This example also has an iOS styled player UI that I created so that it would look similar to the native video player. It has play, pause, a video scrubber and full screen mode. There is a small sample h.264 video included in the example so you can test it out and see it work. On the iPad make sure that your videos are in a folder or in the root and that the folder or files are added to the included file list for your app. Also make sure that the render mode in your app.xml file is either GPU or Direct. Beyond that if you have problems or questions let me know.
Download the sample file here
Copy link to clipboard
Copied
very kind of you smoothblur, thank you!
Copy link to clipboard
Copied
Your are welcome. I had problems getting stageVideo to work on the iPad initially as well so I figured this might helpful to others. There's probably still some remnant code from the app I took this out of so if you have questions or problems let me know.
Copy link to clipboard
Copied
60fps SWF and Video helped me. The 60fps video plays back amazingly on even ipad1.

Copy link to clipboard
Copied
Hi Smoothblur,
Currently, SDK AIR is now at 3.4 and the bug is still not solved with H264 playback.
Your StageVideoDemo is fine and ... many thanks for that !
However, we need a info :
Your preview mp4 video file, used in your example, is a 'video only' sample (no sound).
When we replace your example with a full AudioVideo file (with sound) .. the sound works on web browser thoughout html page, but doesn't works on iPad.
Do we need to change something in your main AS code ?
Thanks for your reply and sorry for our ENG language.
Marc
Paris / France
Copy link to clipboard
Copied
Hello Marc,
My apps that used the video player example that I posted all have working audio, so It should work fine with an mp4 file with audio as well. Make sure that the audio is encoded correctly. Mine used AAC audio and I dont remember the exact audio encodings that the stageVideo supports. My audio/video was encoded using a iPad preset in Adobe Media Encoder.
Let me know if you continue to have problems.
Copy link to clipboard
Copied
You could also give OSMF a shot. It works well also.

Copy link to clipboard
Copied
Hello Smoothblur,
Thanks for your quick answer.
Yes, we saw that your 'preview' clip is encoded with ACC and that your main script really works with sound given that we can hear it throughout the html browser.
Our owner clip is encoded with the same settings. ( ACC for sound and H264 preset for iPad )
That's when we try to read it with iPad that the sound doesn't work during playing.
We didn't hear the soundtrack and, in addition, the sound player of iPad stay in 'grey' (as if it didn't find a soundtrack).
To export the sample .. we're working with Flash pro CS6 (not Flex or Flash builder).. using the last AIR 3.4.
(3.2 and 3.3 version didn't change something .. same trouble).
- We're testing the script in 'speed publish' .. not in 'ad hoc'. ?
- 29ips or 25ips ... ?
Do you think that these params can change something ... (we didn't it ...)
If you get some idea about this problem ? ...
During this time ... we go to see your OSMF link.
Many Thanks ....
Regards
Marc
