Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS][tvOS] Video object doesn't playback MP4 H.264 videos #211

Open
itlancer opened this issue Jan 24, 2020 · 0 comments
Open

[iOS][tvOS] Video object doesn't playback MP4 H.264 videos #211

itlancer opened this issue Jan 24, 2020 · 0 comments

Comments

@itlancer
Copy link

@itlancer itlancer commented Jan 24, 2020

Problem Description

Video object doesn't playback MP4 H.264 videos with iOS and tvOS. NetStream dispatched NetStatusEvent event with NetStream.Play.Failed code.

It has been tested from AIR 13.0.0.83 to latests AIR 32.0.0.89, AIR 32.0.0.144, AIR 33.0.2.338 and AIR 33.1.0.16 beta with many iOS devices. Also tested with Apple TV 4K A1842 with tvOS 13.3. Tested with multiple different videos.
Same problem in all cases.

It works fine using StageVideo for iOS and tvOS with any AIR version.
Also it works fine with Android with AIR 32.0.0.89, AIR 33.0.2.338 and AIR 33.1.0.16 beta.
Also it works fine with Windows and macOS with AIR 32.0.0.89 and below.
Also it works fine with FLV H.263 videos with any AIR version, but FLV H.263 not supported in Media Encoder CC 2014 any more.
It doesn't work with Windows and macOS with AIR 32.0.0.144 and later (AIR 33.0.2.338, AIR 33.1.0.16 beta too) because of issue: #80.

Changing NetStream::useHardwareDecoder with AIR 32 and below doesn't help.
Changing NetStream::useHardwareDecoder to false with AIR 33 cause no video playback with any plaftrom: #155.

Tracker link: https://tracker.adobe.com/#/view/AIR-3840986
Related (not the same) issues with video:
#80
#155
#151
#139
#100
#98
#93
#92
#89
#88
#87
#82
#69
#15
#9

Steps to Reproduce

Launch code below with iOS or tvOS device with MP4 H.264 video. It will try to play video in loop.
Application example with sources and example of video attached.
h264_video_bug.zip

package  {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.NetConnection;
	import flash.net.NetStream;
	import flash.media.Video;
	import flash.events.NetStatusEvent;
	
	public class H264VideoBug extends Sprite {
		private var ns:NetStream;
		private var video:Video = new Video();
		private var nc:NetConnection = new NetConnection();
		
		public function H264VideoBug() {
			addChild(video);

			nc.addEventListener(NetStatusEvent.NET_STATUS, ncHandler);
			nc.connect(null);
		}
		
		private function ncHandler(e:NetStatusEvent):void {
			if (e.info.code == "NetConnection.Connect.Success"){
				ns = new NetStream(nc);
				ns.client = {onMetaData:getMeta, onPlayStatus:onPlayStatus};
				ns.addEventListener(NetStatusEvent.NET_STATUS, nsHandler);
				
				video.attachNetStream(ns);
				ns.play("video.mp4");
			}
		}

		private function nsHandler(e:NetStatusEvent):void {
			trace("ns", e.info.code);
			if (e.info.code == "NetStream.Play.Stop"){
				ns.seek(0);
			}
		}

		private function getMeta(mdata:Object):void { }

		private function onPlayStatus(infoObject:Object):void {
			if (infoObject.code == "NetStream.Play.Complete"){
				ns.seek(0);
			}
		}
	}
}

Actual Result:
White screen (stage color). No video playback. NetStream dispatch NetStream.Play.Failed.

Expected Result:
Video playback.

Known Workarounds

  • Use StageVideo or Stage3D VideoTexture but sometimes it is not an option when you need to use it with DisplayList layers and some other cases.
  • Use FLV H.263 video but it has poor performance and hard to encode such videos because there is no a lot of programs for that. Also in many cases there is no way to pre-encode videos if end user use own MP4 H.264 video for playback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.