Set initial startitme after the video is loaded

This commit is contained in:
Hadi Nategh 2021-02-02 12:35:28 +01:00
parent bbd9a5a765
commit 8f28533288
2 changed files with 32 additions and 9 deletions

View File

@ -24,7 +24,6 @@ var __extends = (this && this.__extends) || (function () {
}; };
})(); })();
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.et2_video = void 0;
/*egw:uses /*egw:uses
/vendor/bower-asset/jquery/dist/jquery.js; /vendor/bower-asset/jquery/dist/jquery.js;
et2_core_interfaces; et2_core_interfaces;
@ -98,9 +97,6 @@ var et2_video = /** @class */ (function (_super) {
if (this.options.src_type) { if (this.options.src_type) {
source.attr('type', this.options.src_type); source.attr('type', this.options.src_type);
} }
if (this.options.starttime) {
this.seek_video(this.options.starttime);
}
} }
}; };
/** /**
@ -164,6 +160,19 @@ var et2_video = /** @class */ (function (_super) {
et2_video.prototype.currentTime = function () { et2_video.prototype.currentTime = function () {
return this.video[0].currentTime; return this.video[0].currentTime;
}; };
et2_video.prototype.doLoadingFinished = function () {
_super.prototype.doLoadingFinished.call(this);
var self = this;
this.video[0].addEventListener("loadedmetadata", function () {
self.videoLoadnigIsFinished();
});
return false;
};
et2_video.prototype.videoLoadnigIsFinished = function () {
if (this.options.starttime) {
this.seek_video(this.options.starttime);
}
};
et2_video._attributes = { et2_video._attributes = {
"video_src": { "video_src": {
"name": "Video", "name": "Video",

View File

@ -148,11 +148,6 @@ export class et2_video extends et2_baseWidget implements et2_IDOMNode
{ {
source.attr('type', this.options.src_type); source.attr('type', this.options.src_type);
} }
if (this.options.starttime)
{
this.seek_video(this.options.starttime);
}
} }
} }
@ -234,5 +229,24 @@ export class et2_video extends et2_baseWidget implements et2_IDOMNode
{ {
return this.video[0].currentTime; return this.video[0].currentTime;
} }
doLoadingFinished(): boolean
{
super.doLoadingFinished();
let self = this;
this.video[0].addEventListener("loadedmetadata", function(){
self.videoLoadnigIsFinished();
});
return false;
}
public videoLoadnigIsFinished()
{
if (this.options.starttime)
{
this.seek_video(this.options.starttime);
}
}
} }
et2_register_widget(et2_video, ["video"]); et2_register_widget(et2_video, ["video"]);