I am implementing a Fairplay Streaming player on Safari.It needs to prefetch a set of keys from KSM before the playback. All the examples I came across implement AvContentKeySession api but it is available only in Swift and Objective-C(for ios). What is equivalent of AVContentKeySession API on MacOS/Safari? Is there a reference code available to implement such a functionality on MacOS/Safari?
Asked
Active
Viewed 199 times
1
-
1According to the docs it is available on macOS as well: https://developer.apple.com/documentation/avfoundation/avcontentkeysession – koen Sep 16 '20 at 19:56
-
@sathish-rao please check my answer. – MGY Apr 22 '21 at 13:37
1 Answers
1
Availability
Here is the availability list per OS, from the documentation:
iOS 10.3+ macOS 10.12.4+
Mac Catalyst 13.0+
tvOS 10.2+
watchOS 7.0+
That means it's available on macOS 10.12.4 and later.
Safari
Apple has an official example project for this (the next title), under the project you can find the FairPlay Streaming in Safari directory which includes an example for Safari.
Official Example
Check the Official Example here. And here is the URL for today's updated example as a zip. Warning: You need to have an Apple Developer membership to download this.
Helpful Resources
The following resources available on the Apple Developer website contain helpful information that you may find useful.
- General information regarding HLS on supported Apple devices and platforms:
- For information regarding topics specific to FairPlay Streaming as well as the latest version of the FairPlay Streaming Server SDK, please see:
- Information regarding authoring HLS content for devices and platforms:
- Information regarding error handling on the server side and with AVFoundation on supported Apple devices and platforms:

MGY
- 7,245
- 5
- 41
- 74