When the play button is clicked I want the mp3/ogg file to start playing from different randomised points.
There's only one button and no visible player for the user to toggle round. It's meant to be like a radio effect.
I am quite new to javascript so need a bit of help. I think I need to have a bit of code that tells it to skip 10-30s randomly through the file. But not sure how to go about it.
Code here:
<a onclick="javascript:toggleSound();"><li><i class="fa fa-play-circle" aria-hidden="true"></i></li></a>
<audio id="audio" preload="auto">
<source src="audio/filename.mp3" type="audio/mpeg"/>
<source src="audio/filename.ogg" type="audio/ogg"/>
function toggleSound() {
var audioElem = document.getElementById('audio');
if (audioElem.paused)
audioElem.play();
else
audioElem.pause();