Cant play live stream from hls-live recorded using livepkgr.
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.
