Netstream video not playing on iPad

2019-08-23 04:59发布

问题:

I am building an iPad app using Flash CS6 to compile to AIR 3.3 on a PC.

One of the app requirements is a video player which can be overlaid with other display element - primarily for subtitles.

I am using Netstream to play MP4 video (have also tried FLVPlayer with same results).
Everything works fine when compiled to run in the emulator, but the video doesn't play once installed on my test device - iPad 3.
(I did a simple test a few months ago and got video playing correctly with audio, but that was CS5.5, AIR 3.1, iPad 2. I will return to this setup, but I obviously do also need to support iPad3...)

So, a couple of quick questions first...
Anyone with the same problems?
Do you know if anything has changed recently on iOS that blocks AIR playing video?

I do the usual netstream / netconnection stuff then pass a File.url to netstream.play().
Here are the guts of the code:

var nc:NetConnection = new NetConnection();
var ns:NetStream;
var vid:Video = new Video();
var videoFile:File;
videoFile = File.applicationDirectory;
videoFile = videoFile.resolvePath(Config.VIDEO_DIRECTORY + 'myVideo.mp4');
nc.connect(null);
ns = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus, false, 0, true);
ns.client = this; // To handle onMetaData & onXMPData
vid.attachNetStream(ns);
vid.smoothing = true;
addChild(vid);
ns.play(videoFile.url);

Publish settings are:

Hardware acceleration :: Level 2 - GPU (have also tried Direct)
Render Mode :: GPU (have also tried Direct)
Device :: iPad
Resolution :: High (have also tried Standard)
Included files :: app.swf, app.xml, assets directory with video / images (images load fine) (tried including .mp4 directly rather than in directory, no difference)

Can any of you help?

回答1:

Ok, fixed.

The above code is all correct (works perfectly), but the video file was wrong.

I still don't understand why, and would welcome some response, but I have switched to .flv formatted video and it works fine.

The file I was testing was encoded for iPad and ran fine when played in AIR on the desktop, and when imported to the iPad and played natively.

Any insight to encoding presets (I am running Adobe Media Encoder) for mp4 would be interesting.



回答2:

I am experiencing the same issue when I started using AIR 3.3. When I attempt to play a video, the app would crash.

When I went back to AIR 3.1, the problem went away and was again able to play the h.264 MP4 video with no problem.

According to the following link, there appears to be a bug in AIR 3.3, which supposedly will be fixed when 3.4 comes out. @See https://bugbase.adobe.com/index.cfm?event=bug&id=3210031



回答3:

i had the same solution, it works with videos included in the build. But if I stream the flv from my server (http) nothing happens...