Copy link to clipboard
Copied
Hi all!
I've setup a live streaming video that works fine. On the server side, we are using The Flash Media Live Encoder streaming to Flash Media Server. On the server, we have checked the box to add a "Timecode" to the video, and set that to just embed the system time.
On the client side, I have a SWF using the FLVPlayback component. I can't seem to figure out how to get the Timecode value on the client. "totalTime" return NaN and "playheadTime" just returns the number of seconds since the client connected. I need to get the system time/timecode that is being embedded on the server.
Thanks!
FYI - I was able to do it by using the "onFI" handler of the embedded NetStream object.
myVideo.addEventListener(fl.video.VideoEvent.STATE_CHANGE, onVideoStateChange);
function onVideoStateChange(evt:fl.video.VideoEvent)
{
// trace("State = " + evt.state);
if ( evt.state == "playing" )
{
if (!ns)
{
ns = myVideo.getVideoPlayer(evt.vp).netStream;
ns.client.onFI = onFIHandler;
}
}
}
function onFIHandler(infoObj:Object):void
{
var ts:String = infoObj.st;
trace("system time: " + ts);
ExternalIn
...Copy link to clipboard
Copied
If the embededd playheadTime gives you false results then start your own timer at the beginning of the video and get its content via currentCount.
//var ticker:timer = new Timer(1000);
ticker.addEventListener(TimerEvent.Timer, tickHandler);
function tickHandler(e:TimerEvent):{
trace(e.currentCount);
//outputs 1...2....3... as long as the movie runs every second
}
Copy link to clipboard
Copied
FYI - I was able to do it by using the "onFI" handler of the embedded NetStream object.
myVideo.addEventListener(fl.video.VideoEvent.STATE_CHANGE, onVideoStateChange);
function onVideoStateChange(evt:fl.video.VideoEvent)
{
// trace("State = " + evt.state);
if ( evt.state == "playing" )
{
if (!ns)
{
ns = myVideo.getVideoPlayer(evt.vp).netStream;
ns.client.onFI = onFIHandler;
}
}
}
function onFIHandler(infoObj:Object):void
{
var ts:String = infoObj.st;
trace("system time: " + ts);
ExternalInterface.call("updateTimeStamp", ts);
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now