Forum Discussion

AmitGoyal-917a2's avatar
AmitGoyal-917a2
Community Member
4 years ago

Update custom variable in ExecuteScript(strId) from user.js

Hi, 

 

I am using clappr player into storyline 360 and it's working properly. But I've help popup into the structure which will be opened on a button click. So my requirement is to pause clappr player when Help popup is open. and resume it when popup closed. 

I am updated my code into user.js but when I create a global variable into user.js and try to update it's value on 
function ExecuteScript(strId)
{...}; 

but value is not updating. So can anyone help me out?

  • My code is:

    var vidurl1 = "abc";
    var _value = "NO";
    var player = new Clappr.Player({
    source: vidurl1,
    autoPlay: true,
    parentId: "#player",
    plugins: {
    container: [ResponsiveContainer]
    }
    });
    player.on(Clappr.Events.PLAYER_PLAY, videoPlay)
    player.on(Clappr.Events.PLAYER_PAUSE, videoPause)
    player.on(Clappr.Events.PLAYER_TIMEUPDATE, timeupdate)

    function timeupdate(e) {
    console.log(_value);
    };
    function calledFun(){
    return _value;
    }
    function videoPause(e) {

    };

    function videoPlay(e) {

    };
    function customFunction(){

    }
    //Clappr Ended


    function ExecuteScript(strId)
    {
    _value = "RS";  //this value is not updating.
    switch (strId)
    {
    case "6AOjn0bN2Mg":
    break;
    }
    };

    function Script1()
    {
    };