Skip navigation
Currently Being Moderated

HLS with Flex 4.7

Dec 18, 2013 7:56 AM

Tags: #flash #hls #apache #fms #h264 #live_streaming #fms_4.5

  Hi, 

 

 

                I am facing an issue implementing HLS with FMS 4.5 (also tried with FMS 5). I am following this article http://help.adobe.com/en_US/flashmediaserver/devguide/WSd391de4d9c7bd6 09-52e437a812a3725dfa0-8000.html.

 

 

When I am publishing live stream to livepkgr application using FMLE (Flash media live encoder). It's all working fine on my ios devices.

But When I am publishing using Flex 4.7 code, the sound is not coming and even video is stop playing after some time on ios devices.

 

Anyone has any idea why is this happening. Any help will be appreciated.

 

I am adding code to review. (You can create a flex project and on creation_complete event call "windowedapplication1_creationCompleteHandler". And change the FMS_serverIp to reall fms server ip.

 

<fx:Script>

                    <![CDATA[

                              import mx.core.UIComponent;

                              import mx.events.FlexEvent;

 

                              var nc:NetConnection;

                              var cam:Camera;

 

                              protected function

 

<fx:Script>

                    <![CDATA[

                              import mx.core.UIComponent;

                              import mx.events.FlexEvent;

 

                              var nc:NetConnection;

                              var cam:Camera;

 

                          protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void{

                                        var ui:UIComponent = new UIComponent();

                                        var v:Video = new Video();

                                                  ui.addChild(v);

                                                  this.addElement(ui);

                                                  this.cam = Camera.getCamera();

                                                  this.cam.setMode(320, 240, 30);

                                                  this.cam.setQuality(0, 100);

 

                                                  v.attachCamera(this.cam);

 

 

                                        this.nc = new NetConnection();

                                        this.nc.client = this;

                                        this.nc.addEventListener(NetStatusEvent.NET_STATUS, startStream);

                                        this.nc.connect("rtmp://FMS_serverIp/livepkgr/");

                              }

 

                              protected function startStream(event:NetStatusEvent):void

                              {

                                        switch (event.info.code){

                                                  case "NetConnection.Connect.Success":

                                                            trace("init stream "+this.nc.uri);

 

                                                            var s:NetStream = new NetStream(this.nc);

 

                                                                      var h264Settings:H264VideoStreamSettings;s

                                                                                 h264Settings = new H264VideoStreamSettings();

                                                                                 h264Settings.setProfileLevel(H264Profile.MAIN, H264Level.LEVEL_1_2);

                                                                                 h264Settings.setMode(320,240,30);

  s.videoStreamSettings = h264Settings;

                                                                                 s.client = this;

                                                                                 s.addEventListener(NetStatusEvent.NET_STATUS, checkMediaStatus);

 

                                                                                 s.attachCamera(this.cam);

                                                                                 s.attachAudio(Microphone.getMicrophone());

                                                                      s.publish("livestream?adbe-live-event=liveevent");

                                                                      trace("Stream is publishing ...");

 

                                                            break;

                                        }

 

 

                              }

 

 

                              protected function checkMediaStatus(event:NetStatusEvent):void

                              {

                                        trace("Stream status "+event.info.code);

 

                              }

 

                    ]]>

          </fx:Script>

 
Replies

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