Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to retrieve item stats to api #584

Open
tjenkinson opened this issue Sep 21, 2015 · 2 comments
Open

Add ability to retrieve item stats to api #584

tjenkinson opened this issue Sep 21, 2015 · 2 comments

Comments

@tjenkinson
Copy link
Member

This can use the playback_history table (#583) to determine:

  • when items were watched
  • how long items were watched for
  • which parts of items were watched
  • how many times items were watched
  • how many times items were watched in any specific time span

This should be available at a /mediaItems/{id}/stats endpoint and also /mediaItems/stats for global stats.

@tjenkinson
Copy link
Member Author

specific media item

Example url: mediaItems/20/stats?streamChunkPeriod=60&streamChunkStart=0&streamNumChunks=4

  • streamChunkPeriod: number of seconds each chunk represents (defaults to something sensible)
  • streamChunkStart: chunk number to start at (defaults to 0)
  • streamNumChunks: the number of chunks to retrieve (defaults to getting all chunks)
  • also vodChunkPeriod etc..
{
    stream: {
        // these totals are the totals this media item has had over all time
        totals: {
            views: 100,
            uniqueViews: 20
        },
        // chunks are from the most recent live stream this media item has had
        chunks: {
            chunkPeriod: 60,
            chunkStart: 0,
            data: [
                {
                    views: 20,
                    uniqueViews: 19,
                    numWatching: 20
                },
                {
                    views: 50,
                    uniqueViews: 1,
                    numWatching: 30
                },
                {
                    views: 30,
                    uniqueViews: 0,
                    numWatching: 90
                }
            ]
        }
    },
    vod: {
        // same as Live except the live format uses the time values were 
        // recorded in the chunks whereas for VOD it can use the actual
        // time positions in the video
        // chunks map to the most recent upload for this media item
    }
}

@tjenkinson
Copy link
Member Author

Implemented /mediaItems/stats/watchingNow
#771

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant