How to show timer for audio tracks?

Special forum to share and discuss skins for Pano2VR and Object2VR
Post Reply
IPrem
Posts: 1
Joined: Tue Oct 29, 2019 6:49 pm

Hi,

How can I achieve this? Is anybody expert in audio / timers?

GOAL:
- I have a background audio. It starts with a dedicated play button. It plays once.
- I would like to show the time where the audio is currently at. For example --> 1min 37sec
- and of course, this timer should increase as the audio keeps playing

TO CONSIDER
- timer should start / stop when we pause the audio
- timer should start from zero when we click "Re-start Audio" button

NOTE:
- I understand that the timer and the audio may not be 100% in sync due to download latency etc.
- But this is for offline viewing on iPad and there is a dedicated Start Audio button (rather than auto start), so there a great chance that the timer will be 99% in sync with audio.

SHARE (or sell)
If you already build something like this, and you are happy to share (or sell), please let me know!

Thank you!
User avatar
Hopki
Gnome
Posts: 13004
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi IPrem,
Pano2VR can not do this out of the box however you can use javascript to do this.
Please see the attached project.

It uses a numbered variable in the skin, then a text box that displays the variable using the placeholder $(*mediaTime).
The text box also has a Config Loaded, Go To URL action to trigger the Javascript.

Note the script:

Code: Select all

javascript: setInterval(function() { player.setVariableValue('mediaTime', player.soundGetTime('Element01')); }, 50);

The Pinned Video has the ID of Element01, which you will see in the script 'Element01'.
This makes the link between the video and the time code display.

The text box will display in seconds.
Regards,
Attachments
timeCode.zip
(3.14 MiB) Downloaded 110 times
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
Post Reply