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

fix: workaround to make Airplay work on Safari #74

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

IEduStu
Copy link

@IEduStu IEduStu commented Apr 20, 2024

Implemented the suggested workaround from this comment to make Airplay work in Safari.

For some reason, audio doesn't play on Airplay on my TV, but I think this should probably be handled on the streaming server.
Previously, using Airplay didn't work at all, so this PR is still an improvement since the video is now displayed on the target device properly.

Airplay support was added to the player of Stremio Web in this PR: Stremio/stremio-web#629

var source = document.createElement('source');
source.src = stream.url;
videoElement.appendChild(source);
videoElement.disableRemotePlayback = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this be moved on line 28?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this has to be done after calling hls.attachMedia(videoElement); and media is attaching, hence this is done on the Hls.Events.MEDIA_ATTACHING event.
I tested this with many other variations and this is the only way that got it working.

function attachOriginalSource() {
var source = document.createElement('source');
source.src = stream.url;
videoElement.appendChild(source);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to add the corresponding action in the unload command handler after the videoElement.removeAttribute('src'); call
something like:
while (videoElement.child) videoElement.removeChild(videoElement.child)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants