mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
Set duration time for webm files based on provided duration url param
This commit is contained in:
parent
1ffe1876c5
commit
8fa2f565b6
@ -130,15 +130,24 @@ class multi_video extends HTMLElement {
|
||||
{
|
||||
let value = _value.split(',');
|
||||
let video = null;
|
||||
let duration = 0;
|
||||
for (let i=0;i<value.length;i++)
|
||||
{
|
||||
video = document.createElement('video');
|
||||
|
||||
if (value[i].match(/&duration=/))
|
||||
{
|
||||
// get duration from url duration param which is necessary for setting duration time of webm file
|
||||
let params = new URLSearchParams(value[i]);
|
||||
duration = parseInt(params.get('duration'));
|
||||
value[i] = value[i].replace(/&duration.*/, '');
|
||||
}
|
||||
video.src = value[i];
|
||||
this._videos[i] = {
|
||||
node:this._wrapper.appendChild(video),
|
||||
loadedmetadata: false,
|
||||
timeupdate: false,
|
||||
duration: 0,
|
||||
duration: duration ? duration : 0,
|
||||
previousDurations: 0,
|
||||
currentTime: 0,
|
||||
active: false,
|
||||
@ -201,7 +210,7 @@ class multi_video extends HTMLElement {
|
||||
});
|
||||
if (allReady) {
|
||||
this._videos.forEach(_item => {
|
||||
_item.duration = _item.node.duration;
|
||||
_item.duration = _item.duration ? _item.duration : _item.node.duration;
|
||||
_item.previousDurations = _item.index > 0 ? this._videos[_item.index-1]['duration'] + this._videos[_item.index-1]['previousDurations'] : 0;
|
||||
});
|
||||
this.duration = this.__duration();
|
||||
|
Loading…
Reference in New Issue
Block a user