Why does the Network API not work in Safari?

Default behaviour on Safari

When Bitmovin player is used with Safari (iOS / macOS) for HLS playback, by default the stream is played through Safari Native Player – not through MSE/HTML5 API as on other web browsers. So, as HLS playback is handled directly by Safari, the Bitmovin Network API’s support is limited. However, some features can be achieved via ServiceWorker as you can read below.

What you can do with native_hls_parsing and ServiceWorker

Enabling the native_hls_parsing tweak on Safari allows to achieve several features that are otherwise not possible with the default Safari Native Player, including support for date range Metadata, and SegmentPlayback events. These features require Bitmovin Player to side-load some of the playlists during playback. As for any download, the player will run the Network API callbacks on these requests, which might be useful. However, be aware that these requests are not going to be consumed by the underlying native player, and thus won't impact playback in any way.

If you are looking to also manipulate requests or responses, this can only be (partially) achieved by enabling a ServiceWorker on top of native_hls_parsing. This way, the requests from Safari Native Player can be intercepted by the service worker, and used by Bitmovin Player for manipulation via Network API.

For details about what Network APIs are supported, please head over to Network API - HTTP request/response manipulations per Platform.

MSE/HTML5 playback on Safari

Although Bitmovin selects the native player by default on Safari, you can force it to use MSE/HTML5 playback instead, and therefore gain full Network API support. One way to achieve this is via preferredTech, as follows:

var conf = { 
    key: "YOUR_PLAYER_KEY_HERE",
    playback: {
        preferredTech: [{player: 'html5', streaming: 'hls'}]
    }
};

⚠️

FairPlay DRM is currently not supported when using MSE/HTML5 playback

Please note that MSE-support is available on:

  • macOS (all versions)
  • iPadOS 13+
  • iOS 17.1+

Using preferredTech as above will automatically fallback to native player on all unsupported platforms.