Event Publish and Subscribe in Player V3 (Deprecated)

You can publish and subscribe to messages for event handling.

Create, Connect, Check, and Load

Important: Ooyala Player V3 is deprecated and is scheduled to be disabled on 2018-01-31. After that date, Player V3 will no longer play your video or audio content. Customers still using Player V3 need to migrate to Player V4 (see Migrating from Player V3 and Player Migration FAQ).
The player message bus provides a means for modules to publish and subscribe to messages for event handling. It uses OO.Player.create and onCreate to create a message bus, connect modules to the message bus, check for 3rd party modules and connect them and then load everything.

OO.Player.create

When called, the OO.Player.create() function:

  • Creates a new message bus.
  • Goes over the list of registered modules and creates all of them.
  • Connects all the registered modules to the message bus.

onCreate

When called, function onCreate(player):

  • Checks for any additional modules (custom, 3rd party or other type).
  • Enables these additional modules to connect to the message bus.
  • Sends a message to the message bus signaling each module to start up.

You must call onCreate() before anything can happen; otherwise, the existing and additional or third-party modules are not connected to the message bus and are not initialized.

Comparing Player V3 and V2 Event Handling

The simplest way to handle events in Player V2 is to define a callback function, then pass its name to the embed tag using the callback parameter. In the current player (Ooyala V3 Player), to handle events, specify an onCreate function that registers for messages in the embedded parameters to the OO.Player.create() call. For example:

     
    function onCreate(player) {
       player.mb.subscribe('*','myPage', function(eventName) {});       
    }

    OO.Player.create('playerwrapper',embedCode, {
      onCreate: window.onCreate
    });
   

해당 내용이 도움 되었습니까?