Brad
Brad

Reputation: 163313

Stop download of streaming audio to HTML5 element with Buzz

I am using Buzz to abstract HTML5 audio for internet radio. This works well, but I need a way to stop downloading the stream when audio is stopped.

For example, when I start playing, I can see the network requests for the stream begin. When I stop audio, that data for the stream is still being transferred, as if it were a static resource. I need to either prevent that from happening, or get it to stop once audio is stopped.

I believe jPlayer does this by destroying the <audio> element, but I don't see any method for doing this in Buzz. Is it possible? If so, how?

Upvotes: 0

Views: 622

Answers (1)

Brad
Brad

Reputation: 163313

After spending some time with the Buzz source, I don't see any method for doing this currently. Fortunately, the raw audio element is exposed, allowing something like this:

buzz.sound.prototype.destroy = function () {
    this.set('src', '');
}

This probably messes up some internal state information for Buzz. I'm looking into that right now.

Upvotes: 0

Related Questions