Reach Player API

Overview

The Beachfront Reach Player API allows webmasters to define callback functions which will be triggered on events emitted from the Beachfront Reach Video Player.

Event Callbacks

The following are all available callbacks that can be set by the end user and their definitions.

Name Description Arguments
PLAYER_INITIATED Fired upon player load. None
VIDEO_SECONDS_ELAPSED Fired approximately every second. Current elapsed time (in seconds) of content video (to three decimal places. Ex. 2.691)
VIDEO_CONTENT_ERROR Occurs when there is an error involving the content. Error message returned by Flash.
VIDEO_CONTENT_LOADED Fired upon content load. The content GUID. Ex. “552d167ce4b041672068dcb0”.
VIDEO_CONTENT_PAUSED Fired when content video is paused. The content GUID. Ex. “552d167ce4b041672068dcb0”.
VIDEO_CONTENT_PLAYING Fired when content has started to play. The content GUID. Ex. “552d167ce4b041672068dcb0”.
VIDEO_CONTENT_ENDED Fired upon content completion. The content GUID. Ex. “552d167ce4b041672068dcb0”.
AD_REQUESTED Fired upon ad request. None
AD_STARTED Fired when the ad begins to play. None
AD_ENDED Fired upon ad completion. None
AD_CLICKED Fired upon ad click. None

Setting API Event Callbacks

API Event callbacks can be set by the end user as follows:

sitePlayer.on(ReachAPI.PlayerEvent.PLAYER_INITIATED, function(arg){console.log('Init')});

sitePlayer.on(ReachAPI.PlayerEvent.VIDEO_SECONDS_ELAPSED, function(arg){console.log('timetrack. Seconds :', arg)});

sitePlayer.on(ReachAPI.PlayerEvent.VIDEO_CONTENT_ERROR, function(arg){console.log('Error. Message : ', arg)});

sitePlayer.on(ReachAPI.PlayerEvent.VIDEO_CONTENT_LOADED, function(arg){console.log('Content loaded. id : ', arg)});

sitePlayer.on(ReachAPI.PlayerEvent.VIDEO_CONTENT_STARTED, function(arg){console.log('Content started')});

sitePlayer.on(ReachAPI.PlayerEvent.VIDEO_CONTENT_PAUSED, function(arg){console.log('Content paused')});

sitePlayer.on(ReachAPI.PlayerEvent.VIDEO_CONTENT_PLAYING, function(arg){console.log('Content playing')});

sitePlayer.on(ReachAPI.PlayerEvent.VIDEO_CONTENT_ENDED, function(arg){console.log('Contnent ended')}); }

sitePlayer.on(ReachAPI.PlayerEvent.AD_REQUESTED, function(arg){console.log('Ad requested')});

sitePlayer.on(ReachAPI.PlayerEvent.AD_STARTED, function(arg){console.log('Ad started')});

sitePlayer.on(ReachAPI.PlayerEvent.AD_ENDED, function(arg){console.log('Ad ended')});

sitePlayer.on(ReachAPI.PlayerEvent.AD_CLICKED, function(arg){console.log('Ad clicked')});

Any subset of the callbacks may be used in this way, so if only the "VIDEO_CONTENT_ENDED" callback was to be used, only it needs to be set.

Example Embed

Below you will find an example embed utilizing two API Callback Events.



<div id="my_reach_player"></div>
<script>
var tag = document.createElement('script');
tag.src = '//api.beachfrontreach.com/reach/client/loader/player.js';

var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

function onReachAPIReady() {

    ReachAPI.Player('my_reach_player', {

        id:   '040ea67a-bc40-44a4-fd7c-615908cb8836'

    }, function (player) {

        player.on(ReachAPI.PlayerEvent.AD_STARTED, function (e) {

            console.log('Ad Started');
        });

        player.on(ReachAPI.PlayerEvent.VIDEO_SECONDS_ELAPSED, function (e) {

            console.log('Video Seconds Elapsed');
        });

    });
}

</script>

Support or Contact

Having trouble with the Player API? Contact support@beachfrontmedia.com and we’ll help you sort it out.

Find out more about Beachfront Media’s products. Here