void HTMLTrackElement::scheduleLoad() { WTF_LOG(Media, "HTMLTrackElement::scheduleLoad"); // 1. If another occurrence of this algorithm is already running for this text track and its track element, // abort these steps, letting that other algorithm take care of this element. if (m_loadTimer.isActive()) return; // 2. If the text track's text track mode is not set to one of hidden or showing, abort these steps. if (ensureTrack()->mode() != TextTrack::hiddenKeyword() && ensureTrack()->mode() != TextTrack::showingKeyword()) return; // 3. If the text track's track element does not have a media element as a parent, abort these steps. if (!mediaElement()) return; // 4. Run the remainder of these steps asynchronously, allowing whatever caused these steps to run to continue. m_loadTimer.startOneShot(0, FROM_HERE); }
void HTMLTrackElement::scheduleLoad() { WTF_LOG(Media, "HTMLTrackElement::scheduleLoad"); // 1. If another occurrence of this algorithm is already running for this text track and its track element, // abort these steps, letting that other algorithm take care of this element. if (m_loadTimer.isActive()) return; // 2. If the text track's text track mode is not set to one of hidden or showing, abort these steps. if (ensureTrack()->mode() != TextTrack::hiddenKeyword() && ensureTrack()->mode() != TextTrack::showingKeyword()) return; // 3. If the text track's track element does not have a media element as a parent, abort these steps. if (!mediaElement()) return; // 4. Run the remainder of these steps in parallel, allowing whatever caused these steps to run to continue. m_loadTimer.startOneShot(0, BLINK_FROM_HERE); // 5. Top: Await a stable state. The synchronous section consists of the following steps. (The steps in the // synchronous section are marked with [X]) // FIXME: We use a timer to approximate a "stable state" - i.e. this is not 100% per spec. }
void HTMLTrackElement::loadTimerFired(Timer<HTMLTrackElement>*) { if (!fastHasAttribute(srcAttr)) return; WTF_LOG(Media, "HTMLTrackElement::loadTimerFired"); // 6. Set the text track readiness state to loading. setReadyState(HTMLTrackElement::LOADING); // 7. Let URL be the track URL of the track element. KURL url = getNonEmptyURLAttribute(srcAttr); // 8. If the track element's parent is a media element then let CORS mode be the state of the parent media // element's crossorigin content attribute. Otherwise, let CORS mode be No CORS. if (!canLoadUrl(url)) { didCompleteLoad(HTMLTrackElement::Failure); return; } ensureTrack()->scheduleLoad(url); }
HTMLTrackElement::ReadyState HTMLTrackElement::readyState() { return static_cast<ReadyState>(ensureTrack()->readinessState()); }
void HTMLTrackElement::setReadyState(ReadyState state) { ensureTrack()->setReadinessState(static_cast<TextTrack::ReadinessState>(state)); if (HTMLMediaElement* parent = mediaElement()) return parent->textTrackReadyStateChanged(m_track.get()); }
TextTrack* HTMLTrackElement::track() { return ensureTrack(); }