How do i get hls metrics
Generated on 7/31/2024
1 search
To get HLS metrics, you can utilize the enhanced client-side metrics available in iOS 18 for HLS streaming assets. These metrics are represented as events, and you can subscribe to these events to gather detailed information about media playback. Here are the steps to obtain HLS metrics:
-
Access Logs and Notifications: Previously, you could obtain some client-side metrics via access logs, error logs, and various AV player notifications.
-
Enhanced Metrics in iOS 18: In iOS 18, the metrics for HLS streaming assets have been enhanced, providing more data points. These metrics are represented as events, which include:
- Playlist Events: Information about fetching the multivariate playlist, video, audio, and subtitle playlists.
- Media Segment Events: Details about fetching media segments and content keys.
- Playback Events: Events like "likely to keep up" indicating when the player has buffered enough to resume playback.
- Stall and Variant Switch Events: Information about playback stalls and variant switches.
- Summary Events: Key performance indicators (KPIs) at the end of a session, such as token switch count.
-
Subscribing to Events: You can subscribe to these events using the AVFoundation APIs. For Objective-C developers, you would create an
AVMetricEventStream
instance, set your subscriber, and add theAVPlayerItem
. Your subscriber will start receiving events, which you can serialize and send to your backend analytics server.
For a detailed walkthrough, you can refer to the session Discover media performance metrics in AVFoundation starting at the "What are events?" chapter.
Relevant Sessions
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.
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.