How do I get the current time of a strip that has a video as a background?

I’m trying to match an audio with video background strip.

$w( ‘#VideoStrip1’ ).onViewportEnter(() => {
$w( ‘#audioPlayer1’ ).play();
})
$w( ‘#VideoStrip1’ ).onViewportLeave(() => {
$w( ‘#audioPlayer1’ ).pause();
})

This works nice only if I stay in my page because the video strip play when you are on view port ands pauses when you are not. But when I go to another window, for example another chrome tab like gmail or whatever, leaving the view port on the video strip, the audioplayer keeps playing but the video pauses. So, when I come back to my page the video and audio are desynchronized.

How do I get the strip video background current time to set it to the audio player?

Thanks!

let currentTime = $w("#myVideoPlayer").currentTime
console.log(currentTime)

Hi russian-dima

Thanks for your answer.

I understand that two lines of code. That works when you have a video player but what I have is a strip with a video as a background. And that function doesn’t work for a strip.

I’ve tried:
let currentTime = $w ( “#StripVideoBackground” ).background. currentTime

But nothing :S

I’m working on similar problem. I needed to change type to number:

let currentTime = Number($w("#Strip").currentTime)

To save it you could use wix-storage for local browsers memory, or database collection.

My experiences with database with some code, and nearly working code. Rather working problem, but may be helpful, just for getting idea.