I’m planning to add my own seekable progress bar to the Air Native Audio Player within the Air Native plugin.
My idea is to add an event listener to track the current playback time and syncing it with my custom progress bar. I’m have very little experience using JavaScript in Bubble. Any input or guidance would be appreciated. Here’s the JS I intend to use:
<script>
function updateAudioInfo() {
const player = window.AirNativeAudioPlayer; // Replace with actual global object
if (player) {
const duration = player.getDuration(); // Replace with actual method
const currentTime = player.getCurrentTime(); // Replace with actual method
bubble_fn_updateDuration(duration);
bubble_fn_updateCurrentTime(currentTime);
}
}
setInterval(updateAudioInfo, 1000); // Update every second
</script>
const player = window.AirNativeAudioPlayer;
player.on('timeupdate', (currentTime) => {
// Use currentTime to update the progress bar
});
player.seekTo(seekTime); // To jump to a specific time (replace seekTime with the target time in seconds)
Does this look like the right approach? I’d appreciate any feedback. Thanks!