Forum Discussion
How to find the duration of the current seek bar dynamically?
Hi Felix,
Happy to help!
There isn't a way to dynamically detect the total duration of a seekbar. The next best thing to do would be to identify the duration of the slide in edit mode (as shown in the screenshot below) and use the Slide.ElapsedTime built-in variable to set a trigger that will fire when the timeline reaches 80% of its total.
I'll let other community members chime in with their own experiences in case someone has a different solution!
- FelixLi-04d0f927 months agoCommunity Member
Hi Jose,
Thank you for replying,
I have used the same method for one of the older class a few month ago, just trying to improve the method as I create more classes.
Recently, I have notice that after publishing the class onto the website, the seek bar have a dynamic percentage (%) value running as the course goes. I was just curious on if there is a way I can reach out to the website to grab the value and use it inside of the course.
Here's what I had in mind -Use JavaScript, then use an animation off the page as a timer, trigger animation to run again once animation complete to make sure the animation goes infinitely. When animation completes (each loop), run JavaScript to get the value from the website and update an variable within the slide. Lastly, make sure that variable is displayed to the player. (Also use this variable to my needs)
Another way to create a similar timer is to do it in a slide layer, setting the timeline to 1 second or however long we need it to be, and jump current time on the timeline to 0 to restart the timeline when timeline completes. However, I need layers to make my courses more interesting, therefore, I wish not to approach it this way.
I'll keep on working on this periodically.Thank you for trying to help.
-Felix