buzzsprout / buzzsprout-api

The official documentation for the Buzzsprout API (http://www.buzzsprout.com).
48 stars 10 forks source link

How to capture play count when loading the audio_url for an episode? #40

Closed eric-hansen closed 1 year ago

eric-hansen commented 1 year ago

The availability for the Buzzsprout player itself is not compact enough for what I'm trying to accomplish (see screenshot for an idea).

So what I plan on doing is fetching the audio URL and playing it through an <audio> element on the page as shown.

There's previous issues filed where it's mentioned the total_plays prop is based on the User Agent and play time of at least 60 seconds when the logs are scrapped.

How does the User Agent play into this exactly (so I can track unique plays)?

image

tomrossi7 commented 1 year ago

Hey @eric-hansen! The user-agent will be the web browser that plays the episode. Does that make sense?

eric-hansen commented 1 year ago

So I just need to pass the user agent of the listener when fetching the audio file?

On Thu, Aug 10, 2023, 7:58 PM Tom Rossi @.***> wrote:

Hey @eric-hansen https://github.com/eric-hansen! The user-agent will be the web browser that plays the episode. Does that make sense?

— Reply to this email directly, view it on GitHub https://github.com/buzzsprout/buzzsprout-api/issues/40#issuecomment-1674066633, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7DKZZ6WC4KUMQ72HL4SQ3XUVYQRANCNFSM6AAAAAA3L6OBKI . You are receiving this because you were mentioned.Message ID: @.***>

tomrossi7 commented 1 year ago

When the browser makes the request to the URL provided in the audio tag, it passes the user-agent like it would for any other web page. Does that make sense?

eric-hansen commented 1 year ago

When the browser makes the request to the URL provided in the audio tag, it passes the user-agent like it would for any other web page. Does that make sense?

Yeah it does. I was thinking I'd have to make an Ajax call on my end but if I keep with the audio element I just need to load it in as the source. Sorry for the confusion in my last message lol.

Is the 60-second-listening part still a requirement as well?

tomrossi7 commented 1 year ago

Its not a requirement, it just won't consider it a play if they don't download at least 60 seconds of data. Be sure that you do not automatically download the full episodes. This will inflate your stats and make them meaningless. I hope that makes sense! Good luck!