Skip navigation
Currently Being Moderated

Live Streaming H.264 Video on iOS using AIR

Dec 12, 2011 9:03 AM

Tags: #air #video #ios #h.264 #streaming #live_streaming #f4m #streaming_video

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

 
Replies
  • Currently Being Moderated
    Dec 14, 2011 4:12 AM   in reply to ScreenName1710b

    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)

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 15, 2011 9:51 AM   in reply to ScreenName1710b

    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>

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 28, 2012 12:22 PM   in reply to ScreenName1710b

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 19, 2012 11:43 AM   in reply to abeymg

       

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 29, 2012 3:49 PM   in reply to drkstr_1

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

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 6, 2013 1:56 AM   in reply to drkstr_1

    could i have a look at your app?

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 6, 2013 1:58 AM   in reply to abeymg

    are u sure of your test app on iOS?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points