How can flash call jquery function in its event
- by user2955639
I want jquery to do something during some of the events when an audio is playing. So I'm coding a function like this
<script>
$.fn.playMedia = function(options){
var opts = $.extend({},
{
swfSrc: ''
timeUpdated: function(currentTime){},
startPlay: function(){},
endPlay: function(){}
},
options);
return $(this).each(function(){
// call flash to play the media whose src is opts.swfSrc
// Is it possible that flash can call the js functions(opts.timeUpdate, opts.startPlay and opts.endPlay) at each time of the event is triggered?
});
}};
</script>
// Usage
<div id="player"></div>
<script>
$('#player').playMedia({
swfSrc: '/path/song.mp3',
timeUpdated: function(currentTime){
comsole.log(currentTime);
}
});
</script>
I'm a totally layman of flash, I just guess this works. Hope someone could tell me how to make up a swf file for this jquery function. Or is there any existing jquery plugin which does this thing but can re-design apperance flexibly. Thank you very much!