Only allow one instance of offset validation watcher per video element
This commit is contained in:
parent
f63fd895fe
commit
cb5218e52d
@ -25,6 +25,8 @@ class VideoData {
|
|||||||
this.videoLoaded = false;
|
this.videoLoaded = false;
|
||||||
this.videoDimensionsLoaded = true;
|
this.videoDimensionsLoaded = true;
|
||||||
|
|
||||||
|
this.validationId = null;
|
||||||
|
|
||||||
this.dimensions = {
|
this.dimensions = {
|
||||||
width: this.video.offsetWidth,
|
width: this.video.offsetWidth,
|
||||||
height: this.video.offsetHeight,
|
height: this.video.offsetHeight,
|
||||||
@ -276,8 +278,14 @@ class VideoData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts fallback change detection (validates whether currently applied settings are correct)
|
||||||
|
*/
|
||||||
async fallbackChangeDetection() {
|
async fallbackChangeDetection() {
|
||||||
while (!this.destroyed && !this.invalid) {
|
const validationId = Date.now();
|
||||||
|
this.validationId = validationId;
|
||||||
|
|
||||||
|
while (!this.destroyed && !this.invalid && this.validationId === validationId) {
|
||||||
await this.sleep(500);
|
await this.sleep(500);
|
||||||
this.doPeriodicFallbackChangeDetectionCheck();
|
this.doPeriodicFallbackChangeDetectionCheck();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user