9 Replies Latest reply: Jan 6, 2013 1:58 AM by heartgoon RSS

    Live Streaming H.264 Video on iOS using AIR

    ScreenName1710b Community Member

      We would like to build an AIR app that plays Streaming H.264 Live/VOD videos that would work through AIR on the iOS platform.

      I've seem some traffic on the forums that RTMP will work to iOS - but additionally heard that video applications that use RTMP streams will be rejected by the Apple App store.

      I have seen that progressive H.264 will work - but that's not streaming or live.

      HLS would work if we use the StageWebView object; however, that provides us little control/monitoring over the video inside of it; and it's not "really" integrated as a video player.

      For OSMF there seems to be a 3rd-Party plugin which will allow OSMF to read HLS streams - but (from what I've heard) is incomplete because it doesn't play adaptive nor is it completely updated for OSMF 1.6.1.

       

      I would love to be wrong here - but is there currently a way to play a Streamed H.264 Video to iOS that is non-RTMP?

      I've seem little information as to if F4M streamed files played via OSMF will work on iOS.

       

      Thanks for the info in advance.

      -Will

        • 1. Re: Live Streaming H.264 Video on iOS using AIR
          abeymg Community Member

          Please see this http://forums.adobe.com/message/4081450#4081450

           

          In short, you can play H264 video in ios using AIR as:

          1. Progressive download

          2. HLS format (OSMF 1.6.1 does not seem to be able to handle HLS, but if you use NetStream directly with StageVideo enabled it works)

          • 2. Re: Live Streaming H.264 Video on iOS using AIR
            ScreenName1710b Community Member

            Yeah - I came across that a while back.

            There's no examples on how to get this to work; I've tried a netstream simple solution (null netconnect and treating it like a progressive mp4 / w stage video) and got nothing; I'll keep testing and post example code if I can get it to work.

            It makes it a little more burdensome that OSMF doesn't support it; but if I can prove netstream can handle it then a OSMF plugin should be pretty straight forward to create for packaging. The video that as posted on that thread (by rossman) claimed that he was getting multibitrate - but he didn't mention how (HLS or RTMP) or any code that he used.

            Since this is the only way that Adobe can deliver Live Video to iOS, and the AIR build to iOS debug cycle; I'd like to see if anyone has a working code sample that they can share.

             

            Thanks.

            -Will

            • 3. Re: Live Streaming H.264 Video on iOS using AIR
              abeymg Community Member

              I pasted a stripped down version of my test app below, that attempts to playback an m3u8 file. This works for me on an IPad2.

              Remember to test on the device itself otherwise wont work.

               

              Dependencies:

               

              1. Air 3.1

              2. OSMF 1.6.1

              3. Flex SDK 4.6.0

               

              renderMode="direct"

               

              HTH

              - Abey

               

              <?xml version="1.0" encoding="utf-8"?>

              <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                             xmlns:mx="library://ns.adobe.com/flex/mx"

                             xmlns:s="library://ns.adobe.com/flex/spark"

                             backgroundAlpha="0"

                             backgroundColor="#000000"

                             addedToStage="onViewActivate(event)"

                             applicationDPI="160">

               

                  <fx:Script>

                      <![CDATA[

                          private var nc:NetConnection;

               

                          private var ns:NetStream;

               

                          private var video:Video;

               

                          private var currentVidUrl:String;

               

                          protected function onViewActivate(event:Event):void

                          {

                              nc = new NetConnection();

                              nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus, false, 0, true);

                              nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityErrorHandler, false, 0, true);

               

                              currentVidUrl = "http://fmsserver/hls-vod/sample.mp4.m3u8";

               

                              nc.connect(null);

               

                          }

               

                          private function onNetStatus(evt:NetStatusEvent):void

                          {

                              switch (evt.info.code) {

                                  case "NetConnection.Connect.Success":

                                      ns = new NetStream(nc);

               

                                      var client:Object = {};

                                      client.onMetaData = onMetaData;

                                      client.onCuePoint = onCuePoint;

                                      client.onBWDone = onBWDone();

               

                                      ns.client = client;

                                      nc.client = client;

               

                                      var v:Vector.<StageVideo> = stage.stageVideos;

                                      if (v.length >= 1) {

                                          var stageVideo:StageVideo = v[0];

                                          stageVideo.viewPort = new Rectangle(0, 0, mediaContainer.width, mediaContainer.height);

                                          stageVideo.attachNetStream(ns);

                                      }

                                      else {

                                          video = new Video();

                                          video.width = mediaContainer.width;

                                          video.height = mediaContainer.height;

                                          mediaContainer.addChildAt(video,0);

                                          video.attachNetStream(ns);

                                      }

               

                                      if (currentVidUrl) {

                                          ns.play(currentVidUrl);

                                      }

               

                                      break;

                                  case "NetStream.Publish.BadName":

                                      break;

                                  default:

                                      break;

                              }

                          }

               

                          private function onSecurityErrorHandler(event:SecurityErrorEvent):void

                          {

                          }

               

                          protected function onMetaData(item:Object):void

                          {

                          }

               

                          protected function onCuePoint(item:Object):void

                          {

                          }

               

                          protected function onBWDone():void

                          {

                          }

                      ]]>

                  </fx:Script>

               

                  <mx:UIComponent id="mediaContainer"

                                  height="100%"

                                  width="100%"/>

               

              </s:Application>

              • 4. Re: Live Streaming H.264 Video on iOS using AIR
                ScreenName1710b Community Member

                Thank you very much - I'll try it out as soon as I can.

                -Will

                • 5. Re: Live Streaming H.264 Video on iOS using AIR
                  drkstr_1 Community Member

                  ScreenName1710b wrote:

                   

                  I've seem some traffic on the forums that RTMP will work to iOS - but additionally heard that video applications that use RTMP streams will be rejected by the Apple App store.

                   

                  I know this is a bit old, but I thought I would mention we have an app in the app store that utilizes RTMP live streaming.

                  • 6. Re: Live Streaming H.264 Video on iOS using AIR
                    HeSaidHuh

                       

                    I am having a heck of a time trying to make this example work within a Spark View. I believe that my first hurdle is to set renderMode to direct via the NativeWindowInitOptions, but I the stage doesn't contain a NativeWindow property. Also, the  UIComponent is never instantiated, it is null. Is it possible to do this within a view? Can anyone point me in the right direction?

                    Thanks,

                    Cliff

                    • 7. Re: Live Streaming H.264 Video on iOS using AIR
                      harmoniser

                      Hi, did you develop that RTMP streaming app for IOS using Flex/Flash Builder or Xcode?

                      • 8. Re: Live Streaming H.264 Video on iOS using AIR
                        heartgoon Community Member

                        could i have a look at your app?

                        • 9. Re: Live Streaming H.264 Video on iOS using AIR
                          heartgoon Community Member

                          are u sure of your test app on iOS?