Forum Discussion
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&badge=0&autopause=0&player_id=0&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>
- RussellKillips-Community Member
Hi Robert,
Try:
player.on('timeupdate', function(data){
SLplayer.SetVar("Videotime2", data.seconds);
});- RobertEdgarCommunity 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
RobertRobert Edgar
Program Manager, Learning Systems Design and Development
Director, Stanford Redwood City Digital Production Studio
Stanford | University Human Resources | Learning Solutions Group
- RussellKillips-Community Member
Hi Robert,
I have attached a sample for you to take a look at.
And here is a link to a published output:
http://www.knowledgeconstruction.com/robert_vimeo/story.html
- RobertEdgar-fe3Community Member
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
- RobertEdgar-fe3Community Member
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?
- RussellKillips-Community Member
The story file is in the zip file that I attached in my previous reply.
- RobertEdgarCommunity Member
And so it was.
I shouldn't work at home...
Thanks again!Robert Edgar
Program Manager, Learning Systems Design and Development
Director, Stanford Redwood City Digital Production Studio
Stanford | University Human Resources | Learning Solutions Group
485 Broadway, University Hall, 3rd Floor, Room U309
Redwood City, CA 94063
Cell: 650-387-5914
Visit Us Online: Learning Solutions Group
Stay Connected: Cardinal at Work Connect
See Our Studio: https://redwoodcity.stanford.edu/campus-resources/srwc-digital-media-production-studio
- RobertEdgar-fe3Community Member
Yes, perfect, it works!
Now I'll check out where I had bad code.
This is great, thanks once more, Russell.
Robert
- RobertEdgar-fe3Community Member
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