diff --git a/api/js/etemplate/et2_widget_video.ts b/api/js/etemplate/et2_widget_video.ts index 701ea2024d..d398a873c6 100644 --- a/api/js/etemplate/et2_widget_video.ts +++ b/api/js/etemplate/et2_widget_video.ts @@ -453,7 +453,16 @@ export class et2_video extends et2_baseWidget implements et2_IDOMNode if (this.youtube.pauseVideo) { this.youtube.pauseVideo(); - this.currentTime(this.youtube.getCurrentTime()); + if (this.youtube.getCurrentTime() != this._currentTime) + { + // give it a chance to get actual current time ready otherwise we would still get the previous time + // unfortunately we need to rely on a timeout as the youtube seekTo not returning any promise to wait for. + setTimeout(_=>{this.currentTime(this.youtube.getCurrentTime());},500); + } + else + { + this.currentTime(this.youtube.getCurrentTime()); + } } } else