当前位置: 首页>>代码示例>>C++>>正文


C++ TextTrack::setMode方法代码示例

本文整理汇总了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;
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:7,代码来源:V8TextTrack.cpp

示例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());
  }
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例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());
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例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());
}
开发者ID:dstockwell,项目名称:blink,代码行数:69,代码来源:AutomaticTrackSelection.cpp


注:本文中的TextTrack::setMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。