本文整理汇总了C++中TextTrackCue::removeDisplayTree方法的典型用法代码示例。如果您正苦于以下问题:C++ TextTrackCue::removeDisplayTree方法的具体用法?C++ TextTrackCue::removeDisplayTree怎么用?C++ TextTrackCue::removeDisplayTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextTrackCue
的用法示例。
在下文中一共展示了TextTrackCue::removeDisplayTree方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateActiveCues
//.........这里部分代码省略.........
// Note: An explicit task is added only if the cue is NOT a zero or
// negative length cue. Otherwise, the need for an exit event is
// checked when these tasks are actually queued below. This doesn't
// affect sorting events before dispatch either, because the exit
// event has the same time as the enter event.
if (missedCue.data()->startTime() < missedCue.data()->endTime()) {
eventTasks.append(
std::make_pair(missedCue.data()->endTime(), missedCue.data()));
}
}
for (const auto& previousCue : previousCues) {
// 10 - For each text track cue in other cues that has its text
// track cue active flag set prepare an event named exit for the
// TextTrackCue object with the text track cue end time.
if (!currentCues.contains(previousCue)) {
eventTasks.append(
std::make_pair(previousCue.data()->endTime(), previousCue.data()));
}
}
for (const auto& currentCue : currentCues) {
// 11 - For each text track cue in current cues that does not have its
// text track cue active flag set, prepare an event named enter for the
// TextTrackCue object with the text track cue start time.
if (!previousCues.contains(currentCue)) {
eventTasks.append(
std::make_pair(currentCue.data()->startTime(), currentCue.data()));
}
}
// 12 - Sort the tasks in events in ascending time order (tasks with earlier
// times first).
nonCopyingSort(eventTasks.begin(), eventTasks.end(), eventTimeCueCompare);
for (const auto& task : eventTasks) {
if (!affectedTracks.contains(task.second->track()))
affectedTracks.append(task.second->track());
// 13 - Queue each task in events, in list order.
// Each event in eventTasks may be either an enterEvent or an exitEvent,
// depending on the time that is associated with the event. This
// correctly identifies the type of the event, if the startTime is
// less than the endTime in the cue.
if (task.second->startTime() >= task.second->endTime()) {
mediaElement.scheduleEvent(
createEventWithTarget(EventTypeNames::enter, task.second.get()));
mediaElement.scheduleEvent(
createEventWithTarget(EventTypeNames::exit, task.second.get()));
} else {
bool isEnterEvent = task.first == task.second->startTime();
AtomicString eventName =
isEnterEvent ? EventTypeNames::enter : EventTypeNames::exit;
mediaElement.scheduleEvent(
createEventWithTarget(eventName, task.second.get()));
}
}
// 14 - Sort affected tracks in the same order as the text tracks appear in
// the media element's list of text tracks, and remove duplicates.
nonCopyingSort(affectedTracks.begin(), affectedTracks.end(),
trackIndexCompare);
// 15 - For each text track in affected tracks, in the list order, queue a
// task to fire a simple event named cuechange at the TextTrack object, and,
// ...
for (const auto& track : affectedTracks) {
mediaElement.scheduleEvent(
createEventWithTarget(EventTypeNames::cuechange, track.get()));
// ... if the text track has a corresponding track element, to then fire a
// simple event named cuechange at the track element as well.
if (track->trackType() == TextTrack::TrackElement) {
HTMLTrackElement* trackElement =
static_cast<LoadableTextTrack*>(track.get())->trackElement();
DCHECK(trackElement);
mediaElement.scheduleEvent(
createEventWithTarget(EventTypeNames::cuechange, trackElement));
}
}
// 16 - Set the text track cue active flag of all the cues in the current
// cues, and unset the text track cue active flag of all the cues in the
// other cues.
for (const auto& cue : currentCues)
cue.data()->setIsActive(true);
for (const auto& previousCue : previousCues) {
if (!currentCues.contains(previousCue)) {
TextTrackCue* cue = previousCue.data();
cue->setIsActive(false);
cue->removeDisplayTree();
}
}
// Update the current active cues.
m_currentlyActiveCues = currentCues;
mediaElement.updateTextTrackDisplay();
}