Add event to the flash player

Issues related to playing with Flash Player

Add event to the flash player

Postby terence » Thu Aug 25, 2011 10:15 pm

Are there any events for the flash player can trigger?
For example, IsPlaying, Connecting, Buffering, Stopped...

I want to use Javascript to write code for these events.
Thank you.
terence
 
Posts: 0
Joined: Thu Aug 25, 2011 10:07 pm

Re: Add event to the flash player

Postby admin » Fri Aug 26, 2011 3:47 pm

Yes, our Flash player supports sending events to it, and receiving events from it.
Our player is based on sonettic-cinema player.

http://sonettic-cinema.com/pdf/player_events.pdf
http://sonettic-cinema.com/documentatio ... pt-api.htm

Basically, you need to call a function addEventListener, when you initialize a player on a webpage.
Here is an example how you can subscribe to Metadata event, get video dimensions out of it, and resize the player accordingly:

<script type="text/javascript">

var onMetadata = function(args)
{
try
{
var object = UMS.Helper.getFlashObject('player-container');
object.width = args.width;
object.height = args.height;
}
catch (e)
{
}
};


</script>

<body id="unload-trigger-element">

<!-- player container -->

<div id="player-container" align="center"></div>

<script type="text/javascript">

embedPlayer('player-container', {

flashvars : {

'rtmp' : 'rtmp://10.1.1.1:5119/live/webcam',

'showMetadata': false

},

size : { width: 480, height: 360 },

playerStyle : 'quick',

callback : function(player){

player.addEventListener('mediaMetadata', onMetadata);

}

});

</script>
</body>
admin
Site Admin
 
Posts: 1039
Joined: Fri Aug 21, 2009 10:13 am

Re: Add event to the flash player

Postby terence » Mon Sep 05, 2011 2:37 am

Thank you for your solution. It works!!!
But I want to ask that whether it is possible to change the rtmp link programmatically by Javascript?
For example, I create 2 buttons. Click button one that will plays channel 1 and button two that will play another RTMP URL.
Thank you.
terence
 
Posts: 0
Joined: Thu Aug 25, 2011 10:07 pm


Return to Playing with Flash Player

Who is online

Users browsing this forum: No registered users and 1 guest

cron