videojs / http-streaming

HLS, DASH, and future HTTP streaming protocols library for video.js
https://videojs-http-streaming.netlify.app/
Other
2.53k stars 425 forks source link

feat: Add Airplay support when overriding native HLS in Safari/iOS #1543

Closed alex-barstow closed 1 month ago

alex-barstow commented 1 month ago

Description

Note: This depends on https://github.com/videojs/video.js/pull/8886. Before we merge this, we will need a new Video.js release and then have to bump the peer dependency version in this package.

This PR adds Airplay support when overriding native HLS in Safari and/or iOS by using two source elements, one for the MediaSource URL object and one for the Airplay-compatible manifest URL.

From the Webkit guide on Airplay and MSE:

When Safari detects that an alternative source is available in addition to the MediaSource URL object, it will display the familiar AirPlay icon to the video player control. Should the user select AirPlay, it will switch over from MSE to the AirPlay-compatible URL.

Specific Changes proposed

If we are playing HLS with MSE in Safari or iOS, set the source by adding two <source> elements-- one for the Media Source blob and one for the HLS manifest that will be used for Airplay. Preserve the existing behavior in all other cases.

Requirements Checklist

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 86.40%. Comparing base (f6a4f79) to head (482c2c4). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1543 +/- ## ========================================== + Coverage 86.36% 86.40% +0.04% ========================================== Files 43 43 Lines 11148 11155 +7 Branches 2545 2550 +5 ========================================== + Hits 9628 9639 +11 + Misses 1520 1516 -4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.