Forum Discussion
Everything we know about Cornerstone on Demand and Storyline!
There's a possible way to get this done using a bit of Javascript, a variable in Storyline, and a trigger to pause the timeline. If you're not comfortable with Javascript, it could be daunting to implement.
The script is described in this stackoverflow post:
You'd want to trigger something that incremented a number value in a storyline variable then use a "when variable changes, pause timeline" trigger. This would let the browser window detect when focus is lost or the window goes into the background. In a Javascript trigger that fires when the slide loads that you want to have the video pause:
var hidden = "hidden";
var player=GetPlayer();
// Standards:
if (hidden in document)
document.addEventListener("visibilitychange", onchange);
else if ((hidden = "mozHidden") in document)
document.addEventListener("mozvisibilitychange", onchange);
else if ((hidden = "webkitHidden") in document)
document.addEventListener("webkitvisibilitychange", onchange);
else if ((hidden = "msHidden") in document)
document.addEventListener("msvisibilitychange", onchange);
// IE 9 and lower:
else if ("onfocusin" in document)
document.onfocusin = document.onfocusout = onchange;
// All others:
else
window.onpageshow = window.onpagehide
= window.onfocus = window.onblur = onchange;
function onchange (evt) {
var v = "visible", h = "hidden",
evtMap = {
focus:v, focusin:v, pageshow:v, blur:h, focusout:h, pagehide:h
};
evt = evt || window.event;
if (evt.type in evtMap){
player.SetVar("yourNumberVariable",Number(player.GetVar("yourNumberVariable))+1);
}
}
// set the initial state (but only if browser supports the Page Visibility API)
if( document[hidden] !== undefined )
onchange({type: document[hidden] ? "blur" : "focus"});
}
Thanks so much for taking the time to send that info!
- NataliaMueller8 years agoCommunity Member
Steve Flowers is pretty awesome like that