Skip to main content
Participant
August 16, 2012
Question

Cant play live stream from hls-live recorded using livepkgr.

  • August 16, 2012
  • 1 reply
  • 1523 views

I am new to FMS but have been doing a lot of reading recently, still cant crack this problem though.

I use a swf to take the users webcam input and publish to FMS 4.5. I publish using the below code:

package

{

          import flash.display.Sprite;

          import flash.events.NetStatusEvent;

          import flash.net.NetConnection;

          import flash.net.NetStream;

          import flash.media.Camera;

          import flash.media.Microphone;

          import flash.media.Video;

          import flash.media.H264Level;

          import flash.media.H264Profile;

          import flash.media.H264VideoStreamSettings;

 

          public class Modelv2 extends Sprite

          {

                    private var nc:NetConnection;

                    private var good:Boolean;

                    private var rtmpNow:String;

                    private var nsIn:NetStream;

                    private var nsOut:NetStream;

                    private var cam:Camera;

                    private var mic:Microphone;

                    private var vidLocal:Video;

                    private var vidStream:Video;

                    public function Modelv2()

                    {

                              rtmpNow = "rtmp://<MYSERVER>/livepkgr/";

                              nc=new NetConnection();

                              nc.connect(rtmpNow);

                              nc.addEventListener(NetStatusEvent.NET_STATUS,checkCon);

                              setCam();

                              setMic();

                              setVideo();

                    }

                    private function checkCon(e:NetStatusEvent):void

                    {

                              good = e.info.code == "NetConnection.Connect.Success";

                              if (good)

                              {

                                        nsOut = new NetStream(nc);

                                        nsOut.attachAudio(mic);

                                        nsOut.attachCamera(cam);

                                        var h264Settings:H264VideoStreamSettings = new H264VideoStreamSettings();

                                        h264Settings.setProfileLevel(H264Profile.BASELINE, H264Level.LEVEL_3_1);

                                        nsOut.videoStreamSettings = h264Settings;

                                        nsOut.publish("Sonia?adbe-live-event=NLL");

                              }

                    }

                    private function setCam()

                    {

                              cam = Camera.getCamera();

                              cam.setKeyFrameInterval(9);

                              cam.setQuality(90000, 90);

                              cam.setMode(640, 480, 30, true);

                    }

                    private function setMic()

                    {

                              mic = Microphone.getMicrophone();

                              mic.gain = 85;

                              mic.rate = 11;

                              mic.setSilenceLevel(15,2000);

                    }

                    private function setVideo()

                    {

                              vidLocal = new Video(cam.width,cam.height);

                              addChild(vidLocal);

                              vidLocal.x = 0;

                              vidLocal.y = 0;

                              vidLocal.attachCamera(cam);

                    }

          }

}

From what I understand this is supposed to automatically create the f4f file inside the streams>_definst_>event folder and create .f4m & .m3u8 files on the fly when requested, from what I can see it's doing this. I see the stream being created while I'm publishing it.

I now want to display the video using a js video control / HTML5 video element depending upon the browser that is serving it. I have successfuly managed to get the stream to play using the url http://<MYSERVER>:8134/hds-live/livepkgr/_definst_/NLL/Sonia.f4m in flowplayer which is great. When I come to try loading the stream in the HTML5 video element I have a problem... it wont load. The url I use is http://<MYSERVER>:8134/hls-live/livepkgr/_definst_/NLL/Sonia.m3u8. I can view the source of the video element and when I click on the link to the video src inside the browser it downloads the .m3u8 file, I have looked inside the file and it is as I expect with a playlist of .ts files. The content of the .m3u8 file is below...

#EXTM3U

#EXT-X-MEDIA-SEQUENCE:138

#EXT-X-ALLOW-CACHE:NO

#EXT-X-VERSION:2

#EXT-X-TARGETDURATION:8

#EXTINF:8,

../../../../hls-live/streams/livepkgr/events/_definst_/NLL/SoniaNum138.ts

#EXTINF:8,

../../../../hls-live/streams/livepkgr/events/_definst_/NLL/SoniaNum139.ts

#EXTINF:8,

../../../../hls-live/streams/livepkgr/events/_definst_/NLL/SoniaNum140.ts

#EXTINF:8,

../../../../hls-live/streams/livepkgr/events/_definst_/NLL/SoniaNum141.ts

#EXTINF:8,

../../../../hls-live/streams/livepkgr/events/_definst_/NLL/SoniaNum142.ts

#EXTINF:8,

../../../../hls-live/streams/livepkgr/events/_definst_/NLL/SoniaNum143.ts

I am really stuck with wthis and am strugling in my attempts to get it fixed. At first I thought it may be that apache is not setup properly (which is why I point directly at the 8134 port without using proxying) but now am thinking it is either the codecs I'm using to publish the stream or that the .ts files are not where the .m3u8 file says they are??

Any help on this would be fantastic. I am away for the weekend but will be back on Monday to follow up if anyone can shed any light at all.

Many Thanks.

Mike.

This topic has been closed for replies.

1 reply

August 17, 2012

Hi Mike,

Flash Player publish only supports Speex and Nelly Moser for Audio, both of which are not supported on iOS devices. This could be the problem with playback.

Thanks,

Apurva

Participant
August 22, 2012

Thanks Apurva,

Is the only option to use two live streams then... One that offers video & audio for browsers that support flashplayer... and another that just streams video for ios device browsers.

I'm assuming that creating a stream that doesnt include an unsupported audio codec allows the stream to play on ios. I'll give it a go myself.

It's quite frustrating that when deciding to go for FMS this restriction wasn't made obvious.

Is there any other way to publish to FMS 4.5 via a bespoke app (i.e. not Flash media encoder) that allows full support on ios device browsers. I've read posts about FFMPEG but remember it being complicated before when I used it inside a windows app.

Thanks,

Mike