mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
Fix youtube video autoplays itself after being seekTo on initiation.
This commit is contained in:
parent
f5b1e5a096
commit
e5ea49a565
@ -307,6 +307,19 @@ var et2_video = /** @class */ (function (_super) {
|
||||
et2_video.prototype.videoLoadnigIsFinished = function () {
|
||||
if (this.options.starttime) {
|
||||
this.seek_video(this.options.starttime);
|
||||
// unfortunately, youtube api autoplays the video after seekTo on initiation
|
||||
// and there's no way to stop that therefore we need to trick it by manually
|
||||
// pausing the video (this would bring up the spinner with the black screen,
|
||||
// in order to avoid that we let the video plays for a second then we pause).
|
||||
// since the youtube timeline is one second advanced we need to seek back to
|
||||
// the original stattime although this time because it was manually paused
|
||||
// we won't have the spinner and black screen instead we get the preview.
|
||||
if (this._isYoutube())
|
||||
window.setTimeout(function () {
|
||||
this.youtube.pauseVideo();
|
||||
this.youtube.seekTo(this.options.starttime);
|
||||
;
|
||||
}.bind(this), 1000);
|
||||
}
|
||||
};
|
||||
et2_video.prototype._onReady = function () {
|
||||
|
@ -443,6 +443,19 @@ export class et2_video extends et2_baseWidget implements et2_IDOMNode
|
||||
if (this.options.starttime)
|
||||
{
|
||||
this.seek_video(this.options.starttime);
|
||||
|
||||
// unfortunately, youtube api autoplays the video after seekTo on initiation
|
||||
// and there's no way to stop that therefore we need to trick it by manually
|
||||
// pausing the video (this would bring up the spinner with the black screen,
|
||||
// in order to avoid that we let the video plays for a second then we pause).
|
||||
// since the youtube timeline is one second advanced we need to seek back to
|
||||
// the original stattime although this time because it was manually paused
|
||||
// we won't have the spinner and black screen instead we get the preview.
|
||||
if (this._isYoutube()) window.setTimeout(function(){
|
||||
this.youtube.pauseVideo();
|
||||
this.youtube.seekTo(this.options.starttime);
|
||||
;}.bind(this), 1000);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user