Forum Discussion

RobertEdgar's avatar
RobertEdgar
Community Member
3 years ago

Getting Vimeo CurrentTime from within Storyline

Hi,

I have the code below working to provide me the Vimeo video playing status.

However, I haven't been able to correctly address the player, in order to obtain the current time (in seconds).

The code below shows my current attempt (with the player.on('timeupdate') code. Anyone able to correct that code, so that I can capture the current time as it plays?

Thanks in advance.

Robert

<iframe id="ckpt1" src="https://player.vimeo.com/video/723853740?h=f2ae10a56b&amp;badge=0&amp;autopause=0&amp;player_id=0&amp;app_id=58479" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen style="position:absolute;top:0;left:0;width:100%;height:100%;" title="AriFirstLoop_Feb.mp4"></iframe>

</div><script src="https://player.vimeo.com/api/player.js">
</script>
<script>

var SLplayer = parent.GetPlayer();
var iframe = document.querySelector('iframe');
var player = new Vimeo.Player(iframe);

player.on('play', function() {
SLplayer.SetVar("videoStatus","Yes Playing");
SLplayer.SetVar("htmlvartest","RESET");
});

player.on('timeupdate', function(data){
SLplayer.SetVar("Videotime2", seconds);
});


player.on('ended', function() {
SLplayer.SetVar("videoStatus","Ended");
});

 

</script>

  • Hi Robert,

    Try:

    player.on('timeupdate', function(data){
    SLplayer.SetVar("Videotime2", data.seconds);
    });

    • RobertEdgar's avatar
      RobertEdgar
      Community Member

      Thanks, Russell.
      However, while the WebObject itself is loading the player and the video,
      When I go to a screen to play it, the video is not loading.

      I'll take a look at this when I am back at work on Monday morning, and see what's up.

      I appreciate your taking the time to offer your suggestion!

      Best
      Robert

      Robert Edgar

      Program Manager, Learning Systems Design and Development

      Director, Stanford Redwood City Digital Production Studio

      Stanford | University Human Resources | Learning Solutions Group

  • OK, it was my email reader that was hiding the attachment. 

    I have it now, and am delighted to try it out. I'll let you know how it goes.

    Thanks

    Robert

  • Hm. The video isn't playing in the web object screen.

    I'll try it from work tomorrow.

    My problem may be in my Javascript on my screen, and not in your web object code itself. Obviously you got it working on your site.

    I did have the video playing previously, though.

    Perhaps attach your .story file?

  • Yes, perfect, it works!

    Now I'll check out where I had bad code.

    This is great, thanks once more, Russell.

     

    Robert

  • OK. I'm working on a Mac (running Parallels), and suspected that my problem was coming from corrupting the files when I moved them from the Mac OS side to the Parallels side. But that was not the case.

    It looks like I had introduced the problem with additional (and unnecessary) JavaScript code I had in other triggers. That and the "data.seconds" correction you gave me.

    This opens up--for me--addressing other data through the Vimeo API, too.

    This will be a good Monday. 

    Best

    Robert