I have a podcast application, where users can listen to podcast.
Having 3 tables mainly
iii) Listening track
I would like to track how much A USER has listened A PODCAST and have a record of the same. I tried using the audio player settings by using played seconds and played proportion but the record is not getting created in the first click itself, it is getting created only in the second click, this seems to be an issue.
So I tried doing the below and would like to have an understanding on how it works.
Action 1: Create a record in Listening track with start time
Action 2: If the user pause, update same record with end time & duration listened by subtracting current time minus start time. This way we get the duration listened for the podcast. (applicable if the audio ends and press back button)
(Every time user press play button start time gets updated and when pressed pause end time updated and added to the duration listened)
I’m not able to get the 2nd action (update) right, i tried the relationships but i’m missing some where.
Ideally what I want to get right is if a podcast is for 20 minutes, I want to check if the user has listened a podcast for 20 minutes, if yes give 10 points to the users table