Bug 589626 - Force canplaythrough to fire when the download has been suspended. r=roc a=blocking

This commit is contained in:
Chris Pearce 2010-09-11 11:29:11 +12:00
Родитель 8e86ed32b7
Коммит 6a2fdb1c3a
4 изменённых файлов: 15 добавлений и 1 удалений

Просмотреть файл

@ -2087,6 +2087,18 @@ void nsHTMLMediaElement::UpdateReadyStateForData(NextFrameStatus aNextFrame)
return;
}
if (mDecoder->GetCurrentStream()->IsSuspendedByCache() &&
!mDecoder->IsEnded())
{
// The download has been suspended by the media cache, and we've not
// completed playback of the resource, so go into HAVE_ENOUGH_DATA state.
// This ensures we always fire canplaythrough and other play events,
// particularly when we suspend the download before the download rate
// has been reliably established.
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA);
return;
}
// Now see if we should set HAVE_ENOUGH_DATA.
// If it's something we don't know the size of, then we can't
// make a real estimate, so we go straight to HAVE_ENOUGH_DATA once

Просмотреть файл

@ -556,6 +556,7 @@ void nsBuiltinDecoder::NotifySuspendedStatusChanged()
// now so we consume data and hopefully free up cache space
mElement->NotifyAutoplayDataReady();
}
UpdateReadyStateForData();
}
void nsBuiltinDecoder::NotifyBytesDownloaded()

Просмотреть файл

@ -17,7 +17,7 @@ var manager = new MediaTestManager;
function startTest(test, token) {
if (!tmpAudio.canPlayType(test.type))
continue;
return;
manager.started(token);
var a1 = new Audio(test.name);
is(a1.getAttribute("preload"), "auto", "Preload automatically set to auto");

Просмотреть файл

@ -49,6 +49,7 @@ SimpleTest.waitForExplicitFinish();
<video id='v'
src='seek.ogv'
onloadedmetadata='return startTest();'
onerror='event.stopPropagation();'
onseeking='return startSeek();'
ontimeupdate='return timeUpdated();'></video>
</body>