Jump to content

Reliable way to identify a single playback session via API?


Recommended Posts

Cr8iveLosr
Posted

Similar to Tautulli, I'm building analytics using the Emby API and I'm running into an issue with playback tracking.

During normal playback the client sends repeated updates like:

  • /Sessions/Playing/Progress

  • /Sessions/Playing/Stopped

  • /Users/{UserId}/PlayedItems/{Id}

Because progress updates are sent frequently (and during pause/seek), a single viewing session generates many events. If you track these directly it looks like multiple plays for the same item.

What I'm trying to determine is:

What is the correct/official way to identify a single playback session using the API?

For example:

  • Is there a recommended session lifecycle to follow?

  • Is there an API endpoint that exposes completed playback sessions?

  • Or is the only reliable method reading the PlaybackActivity table in library.db?

If there isn't currently an API solution, is there a recommended approach for analytics tools that need accurate play/session history without direct database access?

Posted
Quote
  •  

Because progress updates are sent frequently (and during pause/seek), a single viewing session generates many events. If you track these directly it looks like multiple plays for the same item.

Hi, what makes you say that?

Cr8iveLosr
Posted

The issue is that during a single playback session the client sends multiple events such as /Sessions/Playing/Progress, /Sessions/Playing/Stopped, etc.

Because these updates are triggered during pauses, seeks, and other interactions, a single viewing session can produce dozens of events. If analytics tools track these events directly, they appear as multiple playback sessions for the same item.

For example, a user can watch one movie once, but the API activity may show dozens of playback-related events due to progress updates and interaction events. That makes it difficult to reliably determine a single playback session.

So the core question is: what is the recommended way to group these events into a single playback session when building analytics tools?

Specifically:

  • Is there a canonical session identifier we should use?

  • Is there a documented playback session lifecycle developers should follow?

  • Is there an API endpoint that exposes completed playback sessions?

  • Or is reading the PlaybackActivity table in library.db currently the intended approach?

Understanding the recommended method would help avoid incorrect analytics results without relying on direct database access.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...