Tim
Tim

Reputation: 875

Detect Source Of HTML5 Video Pause/Play On Mobile

On mobile phones, if an HTML5 video is playing and the screen is turned off, the video is automatically paused.

How can I detect if the pause/play action was triggered explicitly by the user (by pressing play/pause) or by the system (due to the screen turning off, etc.?)

Upvotes: 0

Views: 226

Answers (1)

Bioto
Bioto

Reputation: 1117

You could use jquery:

$('.yourclassforvideo').on('pause', function() {
    // Do your code
});

I'm not sure if it will be triggered once the screen is locked. Try it out and see what happens :P

Upvotes: 0

Related Questions