BroadSignPlay()
BroadSignPlay()
Broadsign Control Player pre-buffers all ad copies, several seconds before they are displayed, by rendering them off-screen. This ensures that all assets are properly loaded and initialized before the player displays them.
With HTML and web redirects, some cases may require special consideration. For example, JavaScript timers and animations may start while the web page is still pre-buffered off-screen.
To accommodate these cases, the player will try to call a special JavaScript function called BroadSignPlay() when the web page is about to be displayed on a screen.
Here is a short JavaScript sample with the BroadSignPlay() function:
<script>
function startAnimations() {
// Code that goes in the body's onload event --
// animations, plugins and timers -- should start here
}
function BroadSignPlay(){ //set up
startAnimations()
}
</script>
Here is an HTML sample that includes JavaScript using the BroadSignPlay() function, and printing the current time:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="background-color:#EDEDED">
<script type="application/javascript">
//Audio tracks and flash animations should be started inside the BroadSignPlay() function
//This function is automatically called by Broadsign Control Player when the web page is displayed
function BroadSignPlay(){
var dd2 = new Date();var hh = dd2.getHours();var mm = dd2.getMinutes();var ss = dd2.getSeconds();
var data2 = "BroadSignPlay " + hh + ":" + mm + ":" + ss;
document.getElementById( "DivBroadSignPlay" ).innerHTML = data2;
}
//The following JavaScript snippet will ensure that BroadSignPlay() will be called on the page in
//question, and not on the frameset used in web-redirects
if (top.location != location) {
top.location.href = location.href;
}
</script>
<div id="DivBroadSignPlay"> </div>
</body>
</html>
If the content is different in a "normal" browser than in the browser incorporated in Broadsign Control Products, you can use the following logic to circumvent that. The idea is to create a play() function that is either called immediately or wait for the BroadSignPlay() function to call it.
function play() { /* Your Javascript execution code */ }
function BroadSignPlay() {
play();
}
if typeof BroadSignObject === 'undefined'{
play();
}
BroadSignObject
The BroadSignObject
is an object that contains multiple variables related to the player. Its existence in JavaScript indicates that you are inside Broadsign Control Products. So, your code will either be executed immediately in a normal browser or when BroadSignPlay() is called in a Broadsign Control Products browser. For more information, see Print Available JavaScript Variables.