Bug 1550633 - part2 : maybe start loading resource when the track's mode changes. r=jya

According to the spec [1], the user agent must start the track processing model when text track has its text track mode changed.

[1] https://html.spec.whatwg.org/multipage/media.html#sourcing-out-of-band-text-tracks:start-the-track-processing-model

Differential Revision: https://phabricator.services.mozilla.com/D31372

--HG--
extra : moz-landing-system : lando
This commit is contained in:
alwu 2019-05-23 09:05:02 +00:00
Родитель 7ba57e42c0
Коммит 47597aeb6b
2 изменённых файлов: 11 добавлений и 0 удалений

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

@ -256,6 +256,11 @@ void HTMLTrackElement::MaybeDispatchLoadResource() {
return;
}
if (ReadyState() == TextTrackReadyState::Loaded) {
LOG(LogLevel::Info, ("%p Has already loaded resource", this));
return;
}
// step5, await a stable state and run the rest of steps.
if (!mLoadResourceDispatched) {
RefPtr<WebVTTListener> listener = new WebVTTListener(this);

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

@ -129,6 +129,12 @@ void TextTrack::SetMode(TextTrackMode aValue) {
if (mediaElement) {
mediaElement->NotifyTextTrackModeChanged();
}
// https://html.spec.whatwg.org/multipage/media.html#sourcing-out-of-band-text-tracks:start-the-track-processing-model
// Run the `start-the-track-processing-model` to track's corresponding track
// element whenever track's mode changes.
if (mTrackElement) {
mTrackElement->MaybeDispatchLoadResource();
}
// Ensure the TimeMarchesOn is called in case that the mCueList
// is empty.
NotifyCueUpdated(nullptr);