Get Flash movie elapsed details from Javascript
Is it possible to determine how much of a Flash video has elapsed from Javascript code? This would be 开发者_开发技巧for videos that I have not created and have no control over, e.g. from Youtube, Vimeo, etc.
I don't need to control the video in any way, just need to see how far it has played and, if possible, total running time.
It is possible. But it will be dependent in part on which player you are using. If you are using an embeddable video player, instead of a custom player, the player will need to have a javascript method available to give this information. In the case of YouTube, an API exists: http://code.google.com/apis/youtube/js_api_reference.html
But if you build your own player, that loads in another player, for example the chromeless YouTube player for Actionscript 3 - you can monitor the playback with the part of teh application you build, and make it avaiable via the ExternalInterface in actionscript.
The Actionscript ExternalInterface class is the preferred way to handle communication between flash objects and javascript. http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html
精彩评论