Reputation: 51
I'm trying to remove airplay button from native Safari video player on iOS and Mac and I was not able to find a working solution.
It seems imposible to disable it even though documentation says otherwise
I use an .m3u8 source for the video (an online stream from Wowza). Safari ver. 12.1.1 on Mac, iOS 12.1
I have added x-webkit-wirelessvideoplaybackdisabled, x-webkit-airplay="deny"
attributes.
I also set disableRemotePlayback on video element object to true but the airPlay button is still present. https://www.w3.org/TR/remote-playback/#dom-htmlmediaelement-disableremoteplayback
...
const $video = $(`<video style="width: 100%; height: 100%" class="ios-video" controls autoplay muted playsinline x-webkit-airplay="deny" x-webkit-wirelessvideoplaybackdisabled>`);
$video[0].disableRemotePlayback = true;
$video[0].src = stream;
$(self.playerSelector).append($video);
...
I expect that there would be no AirPlay button, but unfortunately even so the webkitWirelessVideoPlaybackDisabled attribute on video element in js is set to true an AirPlay button is still present.
Upvotes: 5
Views: 3904
Reputation: 35002
Opting Into or Out of AirPlay
Video playing in your app or from your website can be enabled for AirPlay or not, at your discretion.
In apps compiled with the base SDK set to iOS 5.0 and later, AirPlay is enabled by default; if you do not want iOS-based devices to be able to play your video over Apple TV, you must disable AirPlay explicitly.
To explicitly opt out of AirPlay, set
x-webkit-airplay
attribute for the video tag or the airplay attribute for the embed tag to"deny"
, as shown in Listing 2-2.
x-webkit-airplay="deny"
I know you said you did that in your question, but that is the solution according to Apple.
Upvotes: 1