How do I get location change events in JavaScript in Mobile Safari?

I want to execute a JavaScript function every second, or whenever the time position on the Mobile Safari video player changes during playback.

Is Is there an event listener or some way to achieve this? I see here how to do it on demand:

In Safari for iPad, how can I get the current video position via Javascript?

However, I am looking for an automatic trigger function Method instead of requiring user interaction to trigger getting the location. Can this be done?

You can attract a lot of activities through HTML5 video. Not all browsers support all browsers, but Mobile Safari should be able to meet your needs well, that is, the “timeupdate” event.

video.addEventListener('timeupdate', function() {
console.log('video time: '+ video.currentTime);
});

You can check the presenter of the event here:
http://www. w3.org/2010/05/video/mediaevents.html

I want to execute the JavaScript function once per second, or whenever the When the time position changes.

Is there an event listener or some way to achieve this? I see here how to do it on demand:

In Safari for iPad, how can I get the current video position via Javascript?

However, I am looking for an automatic trigger function Method instead of requiring user interaction to trigger getting the location. Can this be done?

You can attract a lot of activities through HTML5 video. Not all browsers support all browsers, but Mobile Safari should meet your needs well, This is the “timeupdate” event.

video.addEventListener('timeupdate', function() {
console.log('video time: '+ video .currentTime);
});

You can view the presenter of the event here:
http://www.w3.org/2010/05/video/mediaevents. html

Leave a Comment

Your email address will not be published.