The plugin has 2 main ways with which you can plugin into the player's JS API and start your custom implementation:
- On the main plugin settings screen, you should see an "Enter player onReady callback method name" option. This input field accepts a valid string which represents the name of your JavaScript function located on the page. When this input field is populated, all your players will call this function as a callback as soon as the player loads and is ready for API manipulation.
- On your post/page view, once you post your shortcode, you have the option to add an onReady callback to the player inside the shortcode itself. Here's an example:
[brid video="VIDEO_ID" player="PLAYER_ID" title="Video Title" bridonready="foo"]
By adding bridonready="your_function_name" to your shortcode, you add an onReady callback to the player. You are then free to do your custom coding inside your custom-named method.
NOTE:
- Make sure that the JavaScript method you are setting exists on the page where the player is set and that it is loaded/present before the player. If the method does not exist, the player will not be able to load correctly and will error out.
- If you set an onReady method name both on the settings screen of the plugin and inside a player's shortcode, the one set on the shortcode level will override what is set on the plugin settings level.
- The onReady callback will not work or be added for Brid content units, Google AMP and Facebook Instant Article embed codes.
Comments
0 comments
Please sign in to leave a comment.