From 1d6033fb4e56066da90907fdb531a0d8b2d7f8ad Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 8 May 2020 12:20:37 +0200 Subject: [PATCH] allow to use image spec like "api/mime128_video" for poster like for regular images --- api/js/etemplate/et2_widget_video.js | 5 ++++- api/js/etemplate/et2_widget_video.ts | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/et2_widget_video.js b/api/js/etemplate/et2_widget_video.js index 2fdb6be9d7..cfbc5bd65d 100644 --- a/api/js/etemplate/et2_widget_video.js +++ b/api/js/etemplate/et2_widget_video.js @@ -124,10 +124,13 @@ var et2_video = /** @class */ (function (_super) { * Set poster attribute in order to specify * an image to be shown while video is loading or before user play it * - * @param {string} _url + * @param {string} _url url or image spec like "api/mime128_video" */ et2_video.prototype.set_poster = function (_url) { if (_url) { + if (_url[0] !== '/' && !_url.match(/^https?:\/\//)) { + _url = this.egw().image(_url); + } this.video.attr("poster", _url); } }; diff --git a/api/js/etemplate/et2_widget_video.ts b/api/js/etemplate/et2_widget_video.ts index 5889a32e96..b522936566 100644 --- a/api/js/etemplate/et2_widget_video.ts +++ b/api/js/etemplate/et2_widget_video.ts @@ -176,12 +176,16 @@ export class et2_video extends et2_baseWidget implements et2_IDOMNode * Set poster attribute in order to specify * an image to be shown while video is loading or before user play it * - * @param {string} _url + * @param {string} _url url or image spec like "api/mime128_video" */ set_poster(_url: string) { if (_url) { + if (_url[0] !== '/' && !_url.match(/^https?:\/\//)) + { + _url = this.egw().image(_url); + } this.video.attr("poster", _url); } }