Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Apr 24, 2024
2 parents 19177ab + 4302a6b commit de350e5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions lib/text/ui_text_displayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ shaka.text.UITextDisplayer = class {

/** @private {shaka.util.Timer} */
this.captionsTimer_ = new shaka.util.Timer(() => {
this.updateCaptions_();
if (!this.video_.paused) {
this.updateCaptions_();
}
}).tickEvery(config.captionsUpdatePeriod);

/**
Expand All @@ -88,6 +90,10 @@ shaka.text.UITextDisplayer = class {
this.updateCaptions_(/* forceUpdate= */ true);
});

this.eventManager_.listen(this.video_, 'seeking', () => {
this.updateCaptions_(/* forceUpdate= */ true);
});

// From: https://html.spec.whatwg.org/multipage/media.html#dom-video-videowidth
// Whenever the natural width or natural height of the video changes
// (including, for example, because the selected video track was changed),
Expand Down Expand Up @@ -345,6 +351,9 @@ shaka.text.UITextDisplayer = class {
const cueRegistry = this.currentCuesMap_.get(cue);
goog.asserts.assert(cueRegistry, 'cueRegistry should exist.');
if (cueRegistry.regionElement) {
if (cueRegistry.regionElement.contains(container)) {
cueRegistry.regionElement.removeChild(container);
}
container.appendChild(cueRegistry.regionElement);
cueRegistry.regionElement.appendChild(cueRegistry.cueElement);
} else {
Expand Down Expand Up @@ -379,8 +388,10 @@ shaka.text.UITextDisplayer = class {
if (this.isTextVisible_) {
// Log currently attached cue elements for verification, later.
const previousCuesMap = new Map();
for (const cue of this.currentCuesMap_.keys()) {
previousCuesMap.set(cue, this.currentCuesMap_.get(cue));
if (goog.DEBUG) {
for (const cue of this.currentCuesMap_.keys()) {
previousCuesMap.set(cue, this.currentCuesMap_.get(cue));
}
}

// Update the cues.
Expand Down
2 changes: 1 addition & 1 deletion lib/util/tXml.js
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ shaka.util.TXml = class {
returnPaths.push({
name: nodeName[0],
id: idAttr ?
idAttr[0].match(/'(.*?)'/)[0].replaceAll('\'', '') : null,
idAttr[0].match(/'(.*?)'/)[0].replace(/'/gm, '') : null,
});
}
}
Expand Down

0 comments on commit de350e5

Please sign in to comment.