我正在尝试从 iOS 和 Mac 上的 native Safari 视频播放器中删除播放按钮,但我找不到可行的解决方案。
即使文档另有说明,似乎也无法禁用它
我使用 .m3u8 源视频(来自 Wowza 的在线流)。
Safari 版本。 Mac 上的 12.1.1,iOS 12.1
我已添加 x-webkit-wirelessvideoplaybackdisabled, x-webkit-airplay="deny"
属性。
https://developer.apple.com/library/archive/releasenotes/General/WhatsNewInSafari/Articles/Safari_7_0.html#//apple_ref/doc/uid/TP40014305-CH5-SW6
我还将视频元素对象上的 disableRemotePlayback 设置为 true,但 airPlay 按钮仍然存在。
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);
...
我希望不会有 AirPlay 按钮,但不幸的是,即使如此,js 中 video 元素上的 webkitWirelessVideoPlaybackDisabled 属性设置为 true,AirPlay 按钮仍然存在。
最佳答案
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"
我知道您在问题中说过您这样做了,但根据 Apple 的说法,这是解决方案。
关于html - 如何在 Safari 中禁用 AirPlay 按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57429718/