Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native HLS on Safari only for AirPlay #5022

Open
niklaskorz opened this issue Feb 23, 2023 · 7 comments
Open

Native HLS on Safari only for AirPlay #5022

niklaskorz opened this issue Feb 23, 2023 · 7 comments
Labels
flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this priority: P3 Useful but not urgent type: enhancement New feature or request
Milestone

Comments

@niklaskorz
Copy link
Contributor

Have you read the FAQ and checked for duplicate open issues?

Yes

Is your feature request related to a problem? Please describe.

When using AirPlay on Safari with useNativeHlsOnSafari: false, AirPlay becomes unusable. This is because the blob source set on the video element cannot be handled by the AirPlay target.

Describe the solution you'd like

As of Safari 16.4, Safari can automatically fall back to another supported <source> element when starting AirPlay. An example is provided by this test in the WebKit repository. The basic idea would be to provide both the Media Source Extensions-backed video blob and the address of the HLS playlist as separate <source> elements as children of the <video> element.

Describe alternatives you've considered

An alternative would be to re-enable useNativeHlsOnSafari when AirPlay is requested by the user, seek to the previous timestamp and start playback again.

@niklaskorz niklaskorz added the type: enhancement New feature or request label Feb 23, 2023
@github-actions github-actions bot added this to the Backlog milestone Feb 23, 2023
@avelad avelad added the priority: P3 Useful but not urgent label Feb 28, 2023
@avelad
Copy link
Member

avelad commented Feb 28, 2023

@niklaskorz are you interested on send a PR for this?

@avelad
Copy link
Member

avelad commented Jun 9, 2023

@niklaskorz
Copy link
Contributor Author

I suppose I could work on #5271 and this in a combined PR @avelad, as the "new" AirPlay approach is explicitly mentioned in the context of Managed MSE. Interestingly the hls.js PR video-dev/hls.js#5542 does not seem to have any AirPlay specific changes.

@avelad
Copy link
Member

avelad commented Oct 11, 2023

After having merged #5683 this development has been unlocked.

@avelad
Copy link
Member

avelad commented Jan 11, 2024

@niklaskorz are you interested on send a PR for this?

@avelad avelad added the flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this label Jan 11, 2024
@joeyparrish
Copy link
Member

This snippet from the WebKit blog uses <source> tags to manage an alternate HLS source for AirPlay:

// Add MSE/MMS streaming source
const videoSource1 = document.createElement('source');
videoSource1.type = 'video/mp4';
videoSource1.src = URL.createObjectURL(source); // Create URL from MediaSource
video.appendChild(videoSource1);

// Add AirPlay-compatible HLS source
const videoSource2 = document.createElement('source');
videoSource2. type = 'application/x-mpegURL';
videoSource2.src = airplayURL;
video.appendChild(videoSource2);

We could do this, but we have to be careful to track those <source> elements and clean them up so the <video> element doesn't become cluttered over time after multiple playbacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this priority: P3 Useful but not urgent type: enhancement New feature or request
3 participants