Prevent fullscreen video source in iOS #11067
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
iOS video issues are not new (see: #6443, #6152) but usually come down to carefully following the Autoplay guide for media and Web Audio APIs docs.
While working through the release tests, we noticed that video sources have an internal video element which opts for fullscreen in iOS (with possible dependence on iOS version and iPad vs. iPhone) 😱 . I personally observed the issue in iOS 15 on an iPhone 7 but not on an iPad with iOS 12.5.4.
The issue can be seen on this page: https://docs.mapbox.com/mapbox-gl-js/example/video-on-a-map/
Before this fix, video sources require user input to play and then take over the whole screen:
before.mp4
Adding
video.playsinline = ''
(see: playsinline docs), the video now autoplays as expected:after.mp4
This fix results in correct behavior (autoplay; no fullscreen) on both devices I have access to:
iPhone 7 with iOS 15
iPad Mini with iOS 12.5.4
Launch Checklist
@mapbox/map-design-team
@mapbox/static-apis
if this PR includes style spec API or visual changes@mapbox/gl-native
if this PR includes shader changes or needs a native portmapbox-gl-js
changelog:<changelog>Prevent video sources from entering fullscreen on iOS Safari</changelog>