5

どちらも192kbpsでoggまたはmp3をストリーミングできるIceCast2サーバーをセットアップしました。

私が使用するhtmlでは:

<audio controls autoplay>
    <source src="http://site.com:8000/mount1.ogg" type="audio/ogg">
    <source src="http://site.com:8000/mount2.mp3" type="audio/mp3">
    Your browser does not support the audio element.
</audio>

ただし、Chrome 22 / Firefox 13では、新しい曲が始まるたびに、プレーヤーは再生を停止します。IE10では、問題なく再生を続けます。これは、IEがmp3を使用しているのに対し、ChromeとFirefoxはoggソースを使用しているという事実と関係があるのではないかと思います。192 kbps(音楽がサッケードで聞こえる)を再生するときにOpera 12にも問題があるようですが、128に切り替えて、流暢に動作しました。

誰かがこれの修正を知っていますか?

ご協力いただきありがとうございます!

4

2 に答える 2

5

Posting this as a temporary hack until someone gives a better answer.

In Chrome MEDIA_ERR_DECODE is thrown when the playback stops, while in Firefox it just stops without any error.

I changed the src to currentSrc and then called play() in onerror and onended event, but the sound is sometimes interrupted before resuming play. There must be a better way.

/* jQuery - run on document ready */
$(function ()
{
    var audioElement = $('#audioPlayer')[0];

    audioElement.onended = audioElement.onerror = function()
    {
        audioElement.src = audioElement.currentSrc;
        audioElement.play();
    };
});
于 2012-10-07T17:06:40.337 に答える
-1

You don't have to do so much thing as mentioned above ^ the only problem that i see in your code is that u just wrote auto play. You'll have to make it autoplay=true;

于 2013-05-14T11:31:48.417 に答える