Forum Discussion

FelixLi-04d0f92's avatar
FelixLi-04d0f92
Community Member
8 months ago

How to find the duration of the current seek bar dynamically?

Hi community!

Is there a way I can get the duration of the seek bar from the current slide that the player is reside in? (if I can get the total duration of the seek bar, by applying this in the master slide, it should allow me to do the same stuff for multiple slides.)

I'm trying to tell if a player has completed more than 80% of the current slide, the classes that I'm making have informative audio with different length for most of the slides. If I can get the length of the seek bar, I'll be able to calculate the percentage of the slide that player has completed and giving feedback based on their completion.

I'm able to see something similar to what I wanted to do from the inspect section of the website after publish (image below.) But getting the total duration dynamically will be the step one for what I needed.  

Thanks in advance! 

  • 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-04d0f92's avatar
      FelixLi-04d0f92
      Community 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