Modifying DVRCast to record on publish
I have a need to record and play back (live or recorded) videos with DVR controls. As such, I have downloaded and installed the DVRCast application for Flash Media Server 4.5. The trick is that I need to support videos from two different sources: Flash Media Live Encoder and a VBrick hardware encoder. While it is possible to have FMLE autostart the recording (live playback works properly in this case), I cannot have the VBrick device do the same.
I have spent more time than I would care to admit consulting resources all over the internet and trying to configure DVRCast to automatically start recording during the onPublish event and stop recording during the onUnpublish event, but there is always something missing. For example, the playback of live video (with a StrobeMedia based player) does not automatically seek to the live point and there is no live section of the scrub bar despite the fact that the video duration still appears to be increasing. I know this functionality works on the video player side because it shows up fine streaming live videos from Wowza Media Server. Additionally, streaming to Flash Media Server from the VBrick just yields all kinds of weird behavior. For example, videos played back from that source start 43 seconds into the video and don't allow seeking to a point earlier than that and the video duration is all over the map (sometimes will show up as 22 hours when it's only 30 minutes).
I tried adding the following to onPublish:
var s = Stream.get("mp4:" + stream.name + ".flv");
if (s == undefined) {
trace("s is undefined in onPublish");
return;
}
s.record("append");
s.play(stream.name, -1, -1);
and the following to onUnPublish:
var s = Stream.get("mp4:" + stream.name + ".flv");
if (s == undefined) {
trace("s is undefined in onUnpublish");
return;
}
s.record(false);
s.play(false);
And got the issues described above so something isn't right. Alternatively, I tried having onPublish call the setStreamInfo function in ExDVRStream.asc to approximate the "start recording" command and I couldn't seem to find the right way to call that either.
What am I missing? It really doesn't seem like it should be this hard to do what I'm trying to do and I doubt I'm the only person who's ever needed to do that.
Thanks,
Jim
