How to detect download event in audio and video tags?

Asked

Viewed 40 times

2

I have the following code in a JS file, which I use to detect when someone "plays" or "downloads" audio and video files.

$("audio").on("play",     function() {...}); # Funciona
$("video").on("play",     function() {...}); # Funciona
$("audio").on("download", function() {...}); # Não funciona
$("video").on("download", function() {...}); # Não funciona

However, in the case of "download" the code does not work.

Is there any way to detect when someone "downloads" these files?

1 answer

1

There are ways, but from what I’ve researched, no solution seems to be as trivial as capturing an event. There is none event that detects if the user has downloaded the audio/video.

Here is a very interesting link, showing all these events in operation and their respective properties:

On how to detect the download of not only an audio/video but a page file, here are some references:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.