本文整理汇总了C++中TextTrackCue::regionId方法的典型用法代码示例。如果您正苦于以下问题:C++ TextTrackCue::regionId方法的具体用法?C++ TextTrackCue::regionId怎么用?C++ TextTrackCue::regionId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextTrackCue
的用法示例。
在下文中一共展示了TextTrackCue::regionId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateDisplay
void MediaControlTextTrackContainerElement::updateDisplay()
{
if (!mediaController()->closedCaptionsVisible()) {
removeChildren();
return;
}
HTMLMediaElement* mediaElement = toParentMediaElement(this);
// 1. If the media element is an audio element, or is another playback
// mechanism with no rendering area, abort these steps. There is nothing to
// render.
if (!mediaElement || !mediaElement->isVideo())
return;
// 2. Let video be the media element or other playback mechanism.
HTMLVideoElement* video = static_cast<HTMLVideoElement*>(mediaElement);
// 3. Let output be an empty list of absolutely positioned CSS block boxes.
Vector<RefPtr<HTMLDivElement> > output;
// 4. If the user agent is exposing a user interface for video, add to
// output one or more completely transparent positioned CSS block boxes that
// cover the same region as the user interface.
// 5. If the last time these rules were run, the user agent was not exposing
// a user interface for video, but now it is, let reset be true. Otherwise,
// let reset be false.
// There is nothing to be done explicitly for 4th and 5th steps, as
// everything is handled through CSS. The caption box is on top of the
// controls box, in a container set with the -webkit-box display property.
// 6. Let tracks be the subset of video's list of text tracks that have as
// their rules for updating the text track rendering these rules for
// updating the display of WebVTT text tracks, and whose text track mode is
// showing or showing by default.
// 7. Let cues be an empty list of text track cues.
// 8. For each track track in tracks, append to cues all the cues from
// track's list of cues that have their text track cue active flag set.
CueList activeCues = video->currentlyActiveCues();
// 9. If reset is false, then, for each text track cue cue in cues: if cue's
// text track cue display state has a set of CSS boxes, then add those boxes
// to output, and remove cue from cues.
// There is nothing explicitly to be done here, as all the caching occurs
// within the TextTrackCue instance itself. If parameters of the cue change,
// the display tree is cleared.
// 10. For each text track cue cue in cues that has not yet had
// corresponding CSS boxes added to output, in text track cue order, run the
// following substeps:
for (size_t i = 0; i < activeCues.size(); ++i) {
TextTrackCue* cue = activeCues[i].data();
ASSERT(cue->isActive());
if (!cue->track() || !cue->track()->isRendered() || !cue->isActive())
continue;
RefPtr<TextTrackCueBox> displayBox = cue->getDisplayTree(m_videoDisplaySize.size());
#if ENABLE(WEBVTT_REGIONS)
String regionId = cue->regionId();
TextTrackRegion* region = cue->track()->regions()->getRegionById(regionId);
if (!region) {
// If cue has an empty text track cue region identifier or there is no
// WebVTT region whose region identifier is identical to cue's text
// track cue region identifier, run the following substeps:
#endif
if (displayBox->hasChildNodes() && !contains(static_cast<Node*>(displayBox.get())))
// Note: the display tree of a cue is removed when the active flag of the cue is unset.
appendChild(displayBox, ASSERT_NO_EXCEPTION, AttachNow);
#if ENABLE(WEBVTT_REGIONS)
} else {
// Let region be the WebVTT region whose region identifier
// matches the text track cue region identifier of cue.
RefPtr<HTMLDivElement> regionNode = region->getDisplayTree();
// Append the region to the viewport, if it was not already.
if (!contains(regionNode.get()))
appendChild(region->getDisplayTree());
region->appendTextTrackCueBox(displayBox);
}
#endif
}
// 11. Return output.
if (hasChildNodes())
show();
else
hide();
}