Issue with audioPlayer.seek()

I have multiple audio players on a page for narration. For example, clicking a graphic item triggers playback of a particular player. The issue is that seek(0) only works on the second click. On the first trigger, the audio cues from whatever position it’s at, rather than seeking to 0 first.

Is this a bug? The code is below. I have a switch to turn narration on/off and the “target” is the videoPlayer object passed to the function. It works fine except it initially doesn’t go to 0 until you click a second time. It does the same if I seek(0) directly in the calling function. It doesn’t seek until the second time it’s called.

export function playAudio(target){
$w(target).seek( 0 );
if ($w( “#narrate” ).checked == true )
{
$w(target).play();
}
}

I tried firing .seek(0) twice in the function, still doesn’t work until the function is called the second time.

I am having the exact same problem. Please post if you found a solution. In the meantime I will continue to work on it and post if I get anywhere.

Same problem here. This is a serious bug.

Took me months before I found this work around:

$w . onReady ( function () {

$w ( “#IM01” ). onClick ( ( event ) => { $w ( “#AUD01” ). seek ( 0 ); setTimeout ( function (){ $w ( “#AUD02” ). seek ( 0 )}, 1 ); setTimeout ( function (){ $w ( “#AUD03” ). seek ( 0 )}, 1 ); setTimeout ( function (){ $w ( “#AUD01” ). play ()}, 1 )})

$w ( “#IM02” ). onClick ( ( event ) => { $w ( “#AUD02” ). seek ( 0 ); setTimeout ( function (){ $w ( “#AUD01” ). seek ( 0 )}, 1 ); setTimeout ( function (){ $w ( “#AUD03” ). seek ( 0 )}, 1 ); setTimeout ( function (){ $w ( “#AUD02” ). play ()}, 1 )})

$w ( “#IM03” ). onClick ( ( event ) => { $w ( “#AUD03” ). seek ( 0 ); setTimeout ( function (){ $w ( “#AUD02” ). seek ( 0 )}, 1 ); setTimeout ( function (){ $w ( “#AUD01” ). seek ( 0 )}, 1 ); setTimeout ( function (){ $w ( “#AUD03” ). play ()}, 1 )})
// Write your Javascript code here using the Velo framework API

// Print hello world: 
// console.log("Hello world!"); 

// Call functions on page elements, e.g.: 
// $w("#button1").label = "Click me!"; 

// Click "Run", or Preview your site, to execute your code 

});