From 415cbdf5b26c30cc69abbfd4cc953b2dbab6cabd Mon Sep 17 00:00:00 2001 From: hadi Date: Mon, 13 Nov 2023 12:50:23 +0100 Subject: [PATCH] Fix set video src and duration not working --- .../CustomHtmlElements/multi-video.ts | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/api/js/etemplate/CustomHtmlElements/multi-video.ts b/api/js/etemplate/CustomHtmlElements/multi-video.ts index bc17f58d03..5e143a5655 100644 --- a/api/js/etemplate/CustomHtmlElements/multi-video.ts +++ b/api/js/etemplate/CustomHtmlElements/multi-video.ts @@ -28,6 +28,7 @@ type VideoTagsArray = Array<{ // Create a class for the element class multi_video extends HTMLElement { + private _src : string = ''; /** * shadow dom container * @private @@ -111,7 +112,7 @@ class multi_video extends HTMLElement { switch(name) { case 'src': - this.__buildVideoTags(newVal); + this.src = newVal; break; case 'type': this._videos.forEach(_item => { @@ -132,25 +133,20 @@ class multi_video extends HTMLElement { /** * init/update video tags - * @param _value + * @param array|string _value * @private */ private __buildVideoTags (_value) { - let value = _value.split(','); + let value = Array.isArray(_value) ? _value : _value.split(','); let video = null; let duration = 0; for (let i=0;i{ + Array.from(this._wrapper?.children)?.forEach(_ch=>{ _ch.remove(); }); this.__buildVideoTags(value); @@ -262,7 +259,7 @@ class multi_video extends HTMLElement { */ get src () { - return this.src; + return this._src; } /**