本文整理汇总了C++中TextTrack::setMode方法的典型用法代码示例。如果您正苦于以下问题:C++ TextTrack::setMode方法的具体用法?C++ TextTrack::setMode怎么用?C++ TextTrack::setMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextTrack
的用法示例。
在下文中一共展示了TextTrack::setMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: modeAttrSetter
static void modeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
TextTrack* imp = V8TextTrack::toNative(info.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value);
imp->setMode(v);
return;
}
示例2: disableShowingTextTracks
void MediaControls::disableShowingTextTracks() {
TextTrackList* trackList = mediaElement().textTracks();
for (unsigned i = 0; i < trackList->length(); ++i) {
TextTrack* track = trackList->anonymousIndexedGetter(i);
if (track->mode() == TextTrack::showingKeyword())
track->setMode(TextTrack::disabledKeyword());
}
}
示例3: showTextTrackAtIndex
void MediaControls::showTextTrackAtIndex(unsigned indexToEnable) {
TextTrackList* trackList = mediaElement().textTracks();
if (indexToEnable >= trackList->length())
return;
TextTrack* track = trackList->anonymousIndexedGetter(indexToEnable);
if (track && track->canBeRendered())
track->setMode(TextTrack::showingKeyword());
}
示例4: performAutomaticTextTrackSelection
void AutomaticTrackSelection::performAutomaticTextTrackSelection(const TrackGroup& group)
{
ASSERT(group.tracks.size());
// First, find the track in the group that should be enabled (if any).
HeapVector<Member<TextTrack>> currentlyEnabledTracks;
TextTrack* trackToEnable = nullptr;
TextTrack* defaultTrack = nullptr;
TextTrack* preferredTrack = nullptr;
TextTrack* fallbackTrack = nullptr;
int highestTrackScore = 0;
for (size_t i = 0; i < group.tracks.size(); ++i) {
TextTrack* textTrack = group.tracks[i];
if (m_configuration.disableCurrentlyEnabledTracks && textTrack->mode() == TextTrack::showingKeyword())
currentlyEnabledTracks.append(textTrack);
int trackScore = textTrackSelectionScore(*textTrack);
if (textTrack->kind() == preferredTrackKind())
trackScore += 1;
if (trackScore) {
// * If the text track kind is subtitles or captions and the user has indicated an interest in having a
// track with this text track kind, text track language, and text track label enabled, and there is no
// other text track in the media element's list of text tracks with a text track kind of either subtitles
// or captions whose text track mode is showing
// Let the text track mode be showing.
if (trackScore > highestTrackScore) {
preferredTrack = textTrack;
highestTrackScore = trackScore;
}
if (!defaultTrack && textTrack->isDefault())
defaultTrack = textTrack;
if (!fallbackTrack)
fallbackTrack = textTrack;
} else if (!group.visibleTrack && !defaultTrack && textTrack->isDefault()) {
// * If the track element has a default attribute specified, and there is no other text track in the media
// element's list of text tracks whose text track mode is showing or showing by default
// Let the text track mode be showing by default.
defaultTrack = textTrack;
}
}
if (m_configuration.textTrackKindUserPreference != TextTrackKindUserPreference::Default)
trackToEnable = preferredTrack;
if (!trackToEnable && defaultTrack)
trackToEnable = defaultTrack;
if (!trackToEnable && m_configuration.forceEnableSubtitleOrCaptionTrack && group.kind == TrackGroup::CaptionsAndSubtitles) {
if (fallbackTrack)
trackToEnable = fallbackTrack;
else
trackToEnable = group.tracks[0];
}
if (currentlyEnabledTracks.size()) {
for (size_t i = 0; i < currentlyEnabledTracks.size(); ++i) {
TextTrack* textTrack = currentlyEnabledTracks[i];
if (textTrack != trackToEnable)
textTrack->setMode(TextTrack::disabledKeyword());
}
}
if (trackToEnable)
trackToEnable->setMode(TextTrack::showingKeyword());
}