0 Replies Latest reply on Mar 26, 2014 3:43 AM by sam991

    Unable to play video in iOS via mobile application

    sam991

      I am using adobe flash 4.7 and flash player 12.0 to create a mobile applicaiton both for android and iOS. I am able to play videos in android but unable to play the same video in iOS with the same method.

       

      I have used videoplayer to run videos in android. Here's the code for it

       

      <s:VideoPlayer  width="100%" height="450" autoPlay="false" id="videoPlayer" visible="false">

        <s:source>

           <s:DynamicStreamingVideoSource host="rtmp://fmsexamples.adobe.com/vod/">

             <s:DynamicStreamingVideoItem streamName="MP4:_PS_dreamgirl_150.f4v"/>

          </s:DynamicStreamingVideoSource>

        </s:source>

      </s:VideoPlayer>

       

      I have tried various code to run video on my iPad. Latest code which i have tried is here, but that also failed.

       

      protected function init():void

      {

        stage.addEventListener(StageVideoAvailabilityEvent.STAGE_VIDEO_AVAILABILITY, playVideo);

        this.setFocus();

      }           

      protected function playVideo(event:StageVideoAvailabilityEvent):void

      {

        stageVideoAvail = (event.availability == StageVideoAvailability.AVAILABLE);

        initVideo();

      }

      protected function initVideo():void

      {

        var nc:NetConnection = new NetConnection();

        nc.connect(null);               

        var ns:NetStream = new NetStream(nc);

        ns.client = this;               

        if(stageVideoAvail)

        {

          sv = stage.stageVideos[0];

          sv.addEventListener(StageVideoEvent.RENDER_STATE, onRender);

          sv.attachNetStream(ns);

        }

        else

        {

          var vid:Video = new Video(250, 150);

          addChild(vid);

          vid.attachNetStream(ns);

        }

        ns.play("assets/Part1.mp4");

      }           

      protected function onRender(event:StageVideoEvent):void

      {

        sv.viewPort = new Rectangle(0, 0, 250, 150);

      }

       

      Thanks,

      Samarth

       

      Message was edited by: sam991