MediaPlayer:LiveEvents

From Metrixstream
(Redirected from Media Player: Live Events)
Jump to: navigation, search

Contents

Getting Started

These live events are defined by the media player. When certain actions happen, the media player can notify you which event just took place. From there you can decide trigger another action or ignore it.

JavaScript Definitions

<script type="text/javascript">

var MCONST_CHAT = 0;
var MCONST_NOTICE = 1;
var MCONST_ENTER = 2;
var MCONST_ACCESS_PUBLIC = 3;
var MCONST_ACCESS_PRIVATE_EXCLUSIVE = 4;
var MCONST_MODE_CHANGE = 5;
var MCONST_SHUTDOWN = 6;
var MCONST_ENTER_VOYEUR = 7;
var MCONST_ACCESS_PRIVATE_GROUP = 8;
var MCONST_LEAVE = 9;
var MCONST_HEARTBEAT = 10;
var MCONST_GIFT = 11;

</script>

Variables of the Event

Most events have the same variables associated with them. Each event below will give the exact variables that are accessible with the particular event. The exhaustive list of all the variables across all events are the following.

id
This is a unique identifier of the event. All events have this property.
msgtype
This contains one of the values defined above.
msg
This is the actual message of the event that should be displayed to the viewer.
user
This is the username of the sender of the event.
host
This determines of the event is coming from the Host of the live event or a viewer.
credits
This determines the amount of credits associated with the event.

MCONST_CHAT

This event occurs whenever there is a new chat message. This is the build block to creating your own HTML chat widget. This event also comes bundled with a username of the chat sender, the actual chat message, and whether or not the user is the Host of the live event or a viewer.

MCONST_NOTICE

This event occurs whenever the player is unable to perform a certain action. A typical scenario would be the user sending too many messages. This event would be triggered telling them to slow down. This event comes bundled with the notice message.

MCONST_ENTER

This event occurs when someone starts viewing the live event. Normally this results in adding the user to the viewer roster, so that everyone can see all of the viewers of the live event. This event comes bundled with the enterer's username.

MCONST_ACCESS_PUBLIC

This event occurs when the access mode of the event goes public. A public live event means that there are no restrictions on who can view it. It also means the event is being broadcasted for free.

MCONST_ACCESS_PRIVATE_EXCLUSIVE

This event occurs when the access mode of the event goes exclusively private. This means the event is being viewed by only one viewer and the viewer decided that no one else can join in on the event. This normally implies that the viewer is paying the highest premium per minute.

MCONST_MODE_CHANGE

This event occurs when the mode of the event changes between private exclusive and private group. For the most part, implementations can ignore this message as long as they listen to the public, private exclusive, and private group events.

MCONST_SHUTDOWN

This event occurs when the player detects something wrong. This could be related to software bugs or someone trying to hack the player security. If you receive this event, the player will stop working shortly after, so you need to perform and cleanup of objects and optionally notify the user of what is happening.

MCONST_ENTER_VOYEUR

This event is no longer in use and should be ignored.

MCONST_ACCESS_PRIVATE_GROUP

This event occurs when the access mode of the event allows multiple viewers to view the event. This normally implies a cheaper premium per minute, because there is usually more than one viewer.

MCONST_LEAVE

This event occurs when a viewer leaves the live event. This event is useful because it will allow you to modify your viewer roster as well as notify others that someone just left. This event comes bundled with the leaver's username.

MCONST_HEARTBEAT

This event gets triggered when users are being idle. This event exists so we can properly detect connection issues and remove zombie viewers from the event. This does not imply if you don't interact with the event, that you get kicked out. This is for when there is something wrong and the viewer really is no longer there based on the connection status between the viewer and the server. This event comes bundled with the leaver's username.

MCONST_GIFT

This event occurs when a viewer gifts credits to the broadcaster. This event comes bundled with the username of the gifter, and the amount of credits.

Personal tools