From 3adec01e58c5bb0df5aead9725f403035234d3f0 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 26 Aug 2021 12:11:24 +0200 Subject: [PATCH] Fix youtube video starts to play automatically after being seeked to a time --- api/js/etemplate/et2_widget_video.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/et2_widget_video.ts b/api/js/etemplate/et2_widget_video.ts index 300052ef2d..cde392eb4e 100644 --- a/api/js/etemplate/et2_widget_video.ts +++ b/api/js/etemplate/et2_widget_video.ts @@ -156,6 +156,7 @@ export class et2_video extends et2_baseWidget implements et2_IDOMNode super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_video._attributes, _child || {})); this.set_src_type(this.options.src_type); + this.options.starttime = isNaN(this.options.starttime) ? 0 : this.options.starttime; } set_src_type(_type) @@ -285,7 +286,7 @@ export class et2_video extends et2_baseWidget implements et2_IDOMNode let value = _value>100?100:_value; if (value>= 0) { - if (this._isYoutube() && this.youtube) + if (this._isYoutube() && this.youtube && typeof this.youtube.setVolume === 'function') { this.youtube.setVolume(value); } @@ -569,7 +570,7 @@ export class et2_video extends et2_baseWidget implements et2_IDOMNode public videoLoadnigIsFinished() { - if (this.options.starttime) + if (this.options.starttime >= 0) { this.seek_video(this.options.starttime);