AMS Standard livepkgr FMLE vs Flash Player
Hello all, I'm facing a rather odd behaviour when trying to publish a video stream to livepkgr via Flash Player. Here is the code I'm using:
import flash.media.H264Level;
import flash.media.H264Profile;
import flash.media.H264VideoStreamSettings;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.events.NetStatusEvent;
import flash.media.Camera;
var cl:Object = new Object();
var hd:H264VideoStreamSettings = new H264VideoStreamSettings();
var cam:Camera = Camera.getCamera();
var nc:NetConnection = new NetConnection();
var ns:NetStream;
function onNc(event:NetStatusEvent):void {
if(event.info.code === 'NetConnection.Connect.Success') {
nc.call('FCPublish', null, 'livestream');
}
}
cl.onFCPublish = function(event:Object):void {
if(event.code === 'NetStream.Publish.Start') {
ns = new NetStream(nc);
ns.attachCamera(cam);
ns.videoStreamSettings = hd;
ns.publish('livestream?adbe-live-event=liveevent');
}
}
hd.setProfileLevel(H264Profile.MAIN, H264Level.LEVEL_3_1);
hd.setMode(320, 240, 15);
hd.setQuality(65536, 85);
hd.setKeyFrameInterval(4);
cam.setMode(320, 240, 15);
cam.setQuality(65536, 85);
nc.client = cl;
nc.addEventListener(NetStatusEvent.NET_STATUS, onNc);
nc.connect('rtmp://www.domain.com/livepkgr');
Code for Event.xml:
<Event>
<EventID>liveevent</EventID>
<Recording>
<FragmentDuration>4000</FragmentDuration>
<SegmentDuration></SegmentDuration>
<DiskManagementDuration></DiskManagementDuration>
</Recording>
</Event>
HTTP address for SMP - http://www.domain.com/hds-live/livepkgr/_definst_/liveevent/livestream.f4m
When starting afresh, SMP in debug mode shows fine buffering and FPS. HTTP tracker shows status 200 (which is OK). If I quit FP, 4 seconds later SMP runs out of buffer; the picture freezes, then SMP would periodically issue a 304 status (Not Modified which means that no new data is coming along the track). Problems arise when I re-launch the FP app – in the tracker I still get 304 from SMP although the publish process is in progress. Unless I refresh the SMP window, it still issues that 304 code and the live feed never updates.
On the other hand, FMLE never faces this malfunction. I guess FMLE invokes some supplementary commands (or whatever else it does) to avoid such situation. Moreover, regardless if I quit or stop publishing using FMLE, SMP shows a nice buffering caption, while mere quit of FP doesn’t.
How would I approach such a problem?
