Pass mp3 player event time to a php variable

I am using an mp3 audio player in a php script as follows

   echo "<b><font color='red'>$pic1</b></font>";
}
?>
<br><br><audio controls preload='none'><source src="<?php echo $namehref;?>" type='audio/mp3' /></audio>
<?php
echo "<b><font color='blue'> ";
?>

I want to capture the playback value to a php variable so that I can save the variable embedded in a line with other variables
$click = $Date. " ". $namehref. " ". $country. " ". $city. " ". $region. " ". $playback_value;

and then send it to to a text file

You would first need to capture it in the browser using appropriate JavaScript methods.
Php is not available while the player is playing, because php runs on server and mp3 player on client.

The captured value must be send to the server though to allow it to be processed by some PHP script.
You can use the Javascript fetch API to send data to the server without reloading the page

Sponsor our Newsletter | Privacy Policy | Terms of Service