Closed squareclouds closed 2 years ago
just to be more detailed, i am trying to reset the current video via events.
as a workaround i am doing this:
async reset() {
// bug in youtube if the video was not playing already
let time = await this.player.player.getCurrentTime();
if(time > 0){
this.player.player.pause();
this.player.player.seekTo(0);
}
}
now youtube videos are not getting messed up, but again, it is strange that only youtube has behaving like this.
Hello @squareclouds, could you please share a small reproducible repository? In my tests, your code works.
@yoriiis i will try to recreate it in a simple way this week, my use case is quite complex at this point
Hello @squareclouds, could you please share a small reproducible repository? In my tests, your code works.
hi yoriiis... i am wondering, what did you mean by "my code is working"? again, the code i posted works, yes, because i first check if the video is already at 0, and only if it is not the case i jump to 0. but the original problem i found was, that if you dont check if it is already at 0 and you just jump anyway, the player shows the behaviour i mentioned at the beginning. please let me know if there was a misunderstanding.
here i created a jsfiddle:
https://jsfiddle.net/squareclouds/2x6q1u8g/37/
after the video is loaded i seekTo 0 and vimeo (and html5 as well) dont do anything, as expected, but youtube starts to play.
This is native behavior with Youtube, it will play the video after the seekTo
call if it is not started yet. If the state is different (playing, paused) it does not change. I will keep this behavior even if it is different on other provider. But, if the video is not muted, the browser blocks the playback according to the autoplay policy.
So, I added a fix on the Youtube provider to mute the video in this case only. See PR above.
Describe the bug
this happens only for youtube. if i use the seekTo function the video autoplays after going to that second.
Steps to reproduce
Expected behavior
video should jump to the second but not autoplay, if the video was in paused state
Screenshots and recordings
No response
Vlite.js
4.0.6
Browser
latest firefox and chrome
OS
macos 12.5
Additional context
No response