本文整理汇总了C++中TextTrack::hasBeenConfigured方法的典型用法代码示例。如果您正苦于以下问题:C++ TextTrack::hasBeenConfigured方法的具体用法?C++ TextTrack::hasBeenConfigured怎么用?C++ TextTrack::hasBeenConfigured使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextTrack
的用法示例。
在下文中一共展示了TextTrack::hasBeenConfigured方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: perform
void AutomaticTrackSelection::perform(TextTrackList& textTracks)
{
TrackGroup captionAndSubtitleTracks(TrackGroup::CaptionsAndSubtitles);
TrackGroup descriptionTracks(TrackGroup::Description);
TrackGroup chapterTracks(TrackGroup::Chapter);
TrackGroup metadataTracks(TrackGroup::Metadata);
for (size_t i = 0; i < textTracks.length(); ++i) {
TextTrack* textTrack = textTracks.item(i);
if (!textTrack)
continue;
String kind = textTrack->kind();
TrackGroup* currentGroup;
if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captionsKeyword()) {
currentGroup = &captionAndSubtitleTracks;
} else if (kind == TextTrack::descriptionsKeyword()) {
currentGroup = &descriptionTracks;
} else if (kind == TextTrack::chaptersKeyword()) {
currentGroup = &chapterTracks;
} else {
ASSERT(kind == TextTrack::metadataKeyword());
currentGroup = &metadataTracks;
}
if (!currentGroup->visibleTrack && textTrack->mode() == TextTrack::showingKeyword())
currentGroup->visibleTrack = textTrack;
if (!currentGroup->defaultTrack && textTrack->isDefault())
currentGroup->defaultTrack = textTrack;
// Do not add this track to the group if it has already been automatically configured
// as we only want to perform selection once per track so that adding another track
// after the initial configuration doesn't reconfigure every track - only those that
// should be changed by the new addition. For example all metadata tracks are
// disabled by default, and we don't want a track that has been enabled by script
// to be disabled automatically when a new metadata track is added later.
if (textTrack->hasBeenConfigured())
continue;
if (textTrack->language().length())
currentGroup->hasSrcLang = true;
currentGroup->tracks.append(textTrack);
}
if (captionAndSubtitleTracks.tracks.size())
performAutomaticTextTrackSelection(captionAndSubtitleTracks);
if (descriptionTracks.tracks.size())
performAutomaticTextTrackSelection(descriptionTracks);
if (chapterTracks.tracks.size())
performAutomaticTextTrackSelection(chapterTracks);
if (metadataTracks.tracks.size())
enableDefaultMetadataTextTracks(metadataTracks);
}