0

I have am in the process of making a web radio station and am working on a website for it. Making the audio player like so I have made it so you can pause playback however when resuming the playhead (I guess) isn't at the end like im trying to make thus throwing an error.

Can you guys give me a hand?

HTML

    <!-- AUDIO - - - - - - - - - - - -->
    <audio id="audioplayer" controls="">
        <!-- SOURCE  - - - - - - - - - - -->
        <source src="http://example.com/stream" type="audio/ogg; codecs=&quot;vorbis&quot;" />
    </audio>

JAVASCRIPT

/* Check if the video is paused */
if (audioplayer.paused) {
    /* Make sure the video is playing at the latest time. */
    audioplayer.currentTime = audioplayer.length;
    /* Play the video */
    audioplayer.play();
    /* Change the icon to the pause bars */
    text.textContent = "pause";

} else {
    /* Pause the video */
    audioplayer.pause();
    /* Change the icon to the arrow */
    text.textContent = "play_arrow";
}

The length of the audio stream is a Nan, so I cant use it..

Jake
  • 15
  • 4

0 Answers0