Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Xerces77
Visitor

Way to count how many times a video has been viewed

Greetings-

Is there anyway to tally how many times a particular video has been viewed within your channel?
(Perhaps, if an XML file can be updated within the package and then downloaded by the developer to get its contents)
0 Kudos
6 REPLIES 6
jbrave
Channel Surfer

Re: Way to count how many times a video has been viewed

every time a video is played, you could write to the registry the video name or unique ID and a counter that is incremented, along with a timestamp. You could then upload that information to your webserver periodically.

Or just check your webserver logs, they should tell you the same thing that this would - ip address, authenticated user information, date and times a url was called, etc.

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
Xerces77
Visitor

Re: Way to count how many times a video has been viewed

What registry are you referring to? The user's Roku, or the server where the files are stored?
0 Kudos
jbrave
Channel Surfer

Re: Way to count how many times a video has been viewed

roku's registry. Look in the Component Reference in the SDK for info
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
joetesta
Roku Guru

Re: Way to count how many times a video has been viewed

Hi Xerces77 (and anyone else who might have input) -

Any luck with this? I am looking into generating some stats for a roku channel, (eg number of views per title, amount of bandwidth used per subscriber) and in looking at the apache logs, it seems that the information stored is not going to provide accurate data, since there are multiple requests for a single viewing and it seems that there's no way to tell how much data the user actually received.

I'm thinking about more complicated solutions like taking the ip address' first request for a given title, finding the same ip's last request for that title, subtract the time entries to find out how long they watched, divide by total time of title and multiply by title's file size to approximate the amount of data consumed by that ip address for that title. Actually, this is pretty horrible, because what if they paused it for a half hour 😞

Hopefully there's another better way?

thank you in advance,
Joe
aspiring
0 Kudos
destruk
Streaming Star

Re: Way to count how many times a video has been viewed

Maybe the easiest solution would be through using the "play" or "play from beginning" from the detail screen. "Play" or "Play from beginning" would increment the number of times it was viewed. You could ignore the 'resume playing' option as that would simply be picking up from where the program left off. I don't know how many people exit a video before the end credits are finished - so you could also track maybe the playback position and compare it to (length-10 minutes) and every time that position is reached, count that as one complete viewing. Your count could still be messed up by someone repeatedly watching the last 15 minutes of the program with FF and REW.
0 Kudos
RokuKevin
Visitor

Re: Way to count how many times a video has been viewed

Please take a look at the roSystemLog component and the StreamStart event of the video player. They were designed to gather statistics about playing videos that you can upload to your server.

The roSystemLog example in the component reference will show you how to track the bandwidth selected, http errors, rebuffering...

You could then transfer these stats to your server via an roUrlTransfer.

--Kevin
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.