Beispiel #1
0
void TextTrack::setKind(const AtomicString& newKind)
{
    String oldKind = kind();

#if ENABLE(MEDIA_SOURCE)
    // 10.1 kind, on setting:
    // 1. If the value being assigned to this attribute does not match one of the text track kinds,
    // then abort these steps.
    if (!isValidKindKeyword(newKind))
        return;

    // 2. Update this attribute to the new value.
    setKindInternal(newKind);

    // 3. If the sourceBuffer attribute on this track is not null, then queue a task to fire a simple
    // event named change at sourceBuffer.textTracks.
    if (m_sourceBuffer)
        m_sourceBuffer->textTracks()->scheduleChangeEvent();

    // 4. Queue a task to fire a simple event named change at the TextTrackList object referenced by
    // the textTracks attribute on the HTMLMediaElement.
    if (mediaElement())
        mediaElement()->textTracks()->scheduleChangeEvent();
#else
    TrackBase::setKind(newKind);
#endif

    if (m_client && oldKind != kind())
        m_client->textTrackKindChanged(this);
}
Beispiel #2
0
void TextTrack::setKind(const AtomicString& kind)
{
    String oldKind = m_kind;

    if (isValidKindKeyword(kind))
        m_kind = kind;
    else
        m_kind = subtitlesKeyword();

    if (m_client && oldKind != m_kind)
        m_client->textTrackKindChanged(this);
}