Track progress (using JavaScript) of flv (or swf) loaded into swf
Is this possible? How 开发者_如何学Pythonto do it? Basically I need to track if video was watched fully, and send progress into database via AJAX, but stuck on tracking FLASH.
For this you will have to use the ExternalInterface class inside the code of the swf.
Whenever, there is more data loaded for a video, a progressEvent is generated in swf. When this progress event happens, then you will have to use ExternalInterface, which allows you to call a function in Javascript.
Lets assume, you have a javascript function,
function flvLoadProgressInSwf(percentage)
{
$.ajax()//sending percentage to the server.
}
To call this function , from within flash, you will have to use the following command:
ExternalInterface.call('flvLoadProgressInSwf',percentageLoaded);
where percentageLoaded, can be anything from a sting to a complex object.
Incase you do want some more help, do paste your code. Thanks, Neeraj
精彩评论