Forum Discussion
Store current timeline value
Hi all,
I need to note when the user pauses a video. To do this, I'd like to store this value (e.g. 45 seconds) in a variable that can be then be read in a JavaScript.
I know how to read the variable in JavaScript, but is it possible get the current timeline value and store it in a variable?
Thanks!
Roger
13 Replies
- RogerJCommunity Member
I may be asking for the current value of the playhead?
- ChristiePollickCommunity Member
Hi, Roger -- Thanks for reaching out with your question! Do you have a file started that you might be able to share to help illustrate what you have in mind? And as you mentioned utilizing JavaScript, I wanted to note that is not something for which we'd be able to provide support, so we'd need to defer to your fellow community members to assist you further.
- RogerJCommunity Member
Sorry I'd have to create a file which I can do - but let me please ask this another way removing JavaScript from the question for simplicity.
If someone clicks on a video that is playing, how can I get the number of seconds the video has been playing for use in say a trigger, or storing in a variable?
The user may pause the video, or rewind it. But anytime they click on the running video, I'd like to know when in the video they clicked. For example, the user clicked 23 seconds into the video and store that in a StoryLine variable.
Thanks!
- ChristiePollickCommunity Member
Hi, Roger -- Thanks for your reply, and while I am not aware of a way to accomplish what you have described, perhaps others in the community would be able to offer some ideas or suggestions. And you are always welcome to reach out with your question over in our Building Better Courses forum, as well. :)
- RichardHill-4f3Community Member
You could lay out a bunch of timeline triggers that "execute javascript when timeline reaches cue point/ sec" but it wouldn't be super precise. Video sync tends to drift a tad after 30s.
- RogerJCommunity Member
Thanks Richard. I may be asking for something beyond what StoryLine can do. All I really need is a way to get where (timewise) in the video a user is when they click the video. I guess this property is not exposed.
I want to this value because we are trying to create some interactive video with hotspots. Knowing when the user recognizes a change in the video scene is important.
- RichardHill-4f3Community Member
um you possibly don't need to know the numbers.... http://www.richardleehill.com/hero/elc124/
The above link was done with video on the base layer and a series of hotspots and drag interactions just stopped at key points in the storyline automatically. You can adjust the entry and exit time a hotspot is on your main timeline by just grabbing the ends( https://community.articulate.com/articles/syncing-animations ). If you move the playhead to specific points on the base layer, your video will show you what frame its on. I imported mine in mp4s to my base layer , and removed the seekbar. The only trick is that you will have to place and lock a rectangle with formatted color to transparent over your video( or it will alternate play and stop with every click on it- independent of the timeline) If you want your video to stop, your hotspot could do that, but in principle most scenarios could use this technique (no javascript necessary)
- MichaelHinzeCommunity Member
If you do need/want a time value, you can use a looped offstage animation with a 1 sec-long motionpath. Whenever the motion path completes, a variable is incremented. The variable value represents the playhead's position on the timeline. See this quick example here .I left the 'offstage' object (blue rectangle) in the viewable screen area so that you can see the animation looping. It only takes a handful of triggers to make this work.
- RogerJCommunity Member
Thank you! This is very clever. The challenge is the user can pause or rewind the video. In these use cases, I don't think this timer would work?
Regardless, thank you!
- RogerJCommunity Member
Thank you all for your suggestions! I'll review them.
Roger
- MichaelHinzeCommunity Member
You could overlay the built-in Pause/Play button with a custom button,like I did here. With that, you have complete control over the video. The only thing you couldn't use is the progress bar to jump back and forth in the video.