how do I use analytics with HLS
Generated on 7/31/2024
1 search
To use analytics with HLS (HTTP Live Streaming), you can leverage the new media performance metrics available in iOS 18. Here are the steps and key points to consider:
-
Client-Side Metrics:
- You can obtain client-side metrics via access logs, error logs, and various AV player notifications.
- In iOS 18, these metrics are enhanced and represented as events, providing more data points for HLS streaming assets.
-
Types of Events:
- Events include details about the playback session, such as media segment requests, content key requests, playback stalls, and variant switches.
- These events can be serialized and sent to your backend analytics server for further analysis.
-
Subscribing to Events:
- You can subscribe to these events using the AVFoundation API.
- For Objective-C developers, you would create an
AVMetricEventStream
instance, set your subscriber, and add theAVPlayerItem
. Your subscriber will then start receiving events.
-
Using the Metrics:
- The metrics can help triage issues in the field, such as playback taking too long to start or stalling during playback.
- They provide insights into the workings of AVFoundation APIs, which can be useful for improving performance.
-
Summary Events:
- At the end of a playback session, a summary event is created, providing key performance indicators (KPIs) such as token switch count. These KPIs can help monitor media playback health at scale.
For a detailed walkthrough, you can refer to the session Discover media performance metrics in AVFoundation starting at 01:10.
Relevant Sessions
These sessions provide comprehensive insights into using analytics with HLS and enhancing ad experiences with HLS interstitials.
Enhance ad experiences with HLS interstitials
Explore how HLS Interstitials can help you seamlessly insert advertisements into your HLS content. We’ll also show you how to use integrated timeline to tune your UI experience and build SharePlay for interstitials.
Discover media performance metrics in AVFoundation
Discover how you can monitor, analyze, and improve user experience with the new media performance APIs. Explore how to monitor AVPlayer performance for HLS assets using different AVMetricEvents, and learn how to use these metrics to understand and triage player performance issues.