1
0
mirror of https://github.com/algora-io/tv.git synced 2024-11-16 00:58:59 +02:00

handle current_time for youtube videos in VideoPlayer hook

This commit adds a workaround for setting the current time on YouTube videos.
It introduces a 2-second delay to allow the video to load before setting the
time, addressing an issue where the time wasn't being set correctly for
YouTube videos.
This commit is contained in:
zafer 2024-08-19 20:25:19 +03:00
parent 70d3637c39
commit b6ec959a01

View File

@ -206,8 +206,15 @@ const Hooks = {
setMediaSession();
if (opts.current_time && opts.player_type !== "video/youtube") {
this.player.currentTime(opts.current_time);
if (opts.current_time) {
if (opts.player_type === "video/youtube") {
// HACK: wait for the video to load
setTimeout(() => {
this.player.currentTime(opts.current_time);
}, 2000);
} else {
this.player.currentTime(opts.current_time);
}
}
if (backdrop) {