pillarbox-apple icon indicating copy to clipboard operation
pillarbox-apple copied to clipboard

Add support for `AVMetrics`

Open defagos opened this issue 7 months ago • 9 comments

As a Pillarbox developer I want to benefit from new APIs introduced in iOS and tvOS 18 to better understand the behavior of Pillarbox.

Remarks

timeSpentInInitialStartup provided in AVMetricPlayerItemPlaybackSummaryEvent matches timeTaken from AVMetricPlayerItemInitialLikelyToKeepUpEvent. These values are smaller than the values we get when measuring the total startup time according to recommendations provided at WWDC. It is also the same value as provided by the first event startupTime in the access log.

Hints

  • AVMetrics are missing in iOS 18 beta 1.
  • In beta 2 they are only observed on device.
  • The same metric AVMetricContentKeyRequestEvent provides the key system used to load the content. It can be compared to clearKey, authorizationToken or fairPlayStreaming to find its type, letting us guess which timing we need to provide. Note that our token-protected streams are currently reported as using clearKey.

Acceptance criteria

  • Native AVPlayer metrics are provided in Pillarbox player metric events.

Tasks

  • [x] Deliver native AVMetrics events.
  • [x] ~Check consistency between APIs (e.g. stalls or fatal / non-fatal errors).~
  • [x] Mark custom events with a native counterpart as deprecated on iOS / tvOS 18+.
  • [ ] Check if content key retrieval metrics (for Akamai token resource loading) match timings we obtain with logs in the resource loader delegate implementation itself.
  • [ ] Provide resource loading / content session metrics in Pillarbox reports.
  • [x] Make sure the code compiles with Xcode 15 until Xcode 16 is released (check that compiler version >= 6.0).
  • [ ] Display relevant metrics in demo metrics view (e.g. resource loading / content key session).
  • [ ] Decide if we want to have the same behavior as our metric event API (collect events for each item right from the start; this would force AVMetricEvent to be collected even if not needed, though). Or we could just collect some essential events and discard less relevant ones, at least for tracker implementation purposes.
  • [ ] Check behavior in playlists.
  • [ ] Check we can subscribe to native metric event publishers from different locations at the same time (to check if this is beta issue, consume two metric async streams from two different locations in a sample project).

defagos avatar Jul 05 '24 16:07 defagos