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

Closed
niklaskorz opened this issue Feb 23, 2023 · 7 comments · Fixed by #7431
Closed

Native HLS on Safari only for AirPlay #5022

niklaskorz opened this issue Feb 23, 2023 · 7 comments · Fixed by #7431
Assignees
Labels
browser: Safari Issues affecting Safari or WebKit derivatives 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

More info in https://developer.apple.com/wwdc23/10122

@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
@avelad
Copy link
Member

avelad commented Feb 29, 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.

@tykus160 tykus160 self-assigned this Oct 4, 2024
@avelad avelad removed the flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this label Oct 9, 2024
@avelad avelad modified the milestones: Backlog, v4.12 Oct 9, 2024
tykus160 added a commit that referenced this issue Oct 15, 2024
Needed for #5022 

This PR does not enable AirPlay on MSE yet, but moves shaka from using
`src` attribute to `source` tags. With this change we will be able to
enable it more easily, as `src` and `source` should not be used
together.
@avelad avelad added browser: Safari Issues affecting Safari or WebKit derivatives component: AirPlay labels Oct 18, 2024
avelad added a commit that referenced this issue Oct 25, 2024
avelad added a commit that referenced this issue Oct 28, 2024
@avelad avelad closed this as completed in a6cf9cb Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser: Safari Issues affecting Safari or WebKit derivatives priority: P3 Useful but not urgent type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants