Duration of Audio via Javascript

Problem:
Hi,
is it possible to get the duration of an audio object through javascript similar to duration() for the whole presentation?
Thanks, Rolf

ActivePresenter version:

OS:

Notes:

Hi Rolf,

The following code returns the duration of the audio resource but not the playback duration in timelines. However, it will return NaN if the audio is not loaded yet.

var obj, player, nativePlayer, duration;
obj = prez.object("myAudio");
if (!obj)
    return;
player = obj.mediaPlayer();
if (!player)
    return;
nativePlayer = player.nativePlayer();
if (!nativePlayer)
    return;
duration = nativePlayer.duration;

Regards,

1 Like