I want to start a YouTube video at 9:40s inside the Wix video player. I copied the YT link with specific timestamp into the video player, but the video doesn’t start at the right time and the playhead moves backward toward the beginning of the video after each refresh.
I attempted to solve this issues with code:
$w . onReady ( function () {
$w ( "#wonderfulPlayer" ). onClick (() => {
$w ( '#videoPlayer1' ). onViewportEnter (( event ) => {
$w ( '#videoPlayer1' ). seek ( 582 )
. then (() => {
console . log ( "Done with seek" );
});
$w ( '#wonderfulPlayer' ). onViewportLeave (() => {
$w ( '#videoPlayer1' ). pause ();
});
});
});
});
I am a beginning coder so excuse my ignorance of the fundamentals.
The wix video player is grouped so I can use the onClick property, which isn’t available for the video player element.
My ideal solutions would do this:
user clicks on video > video starts at 9:40 > when user’s viewport leaves OR pauses video, current time remains on playhead.
Here’s a video of my code running:
Help please.