Skip to content

Prevent fullscreen video source in iOS#11067

Merged
rreusser merged 1 commit intomainfrom
ricky/fix-ios-video
Oct 1, 2021
Merged

Prevent fullscreen video source in iOS#11067
rreusser merged 1 commit intomainfrom
ricky/fix-ios-video

Conversation

@rreusser
Copy link
Copy Markdown
Contributor

@rreusser rreusser commented Sep 29, 2021

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

  • briefly describe the changes in this PR
  • include before/after visuals or gifs if this PR includes visual changes
  • write tests for all new functionality
  • document any changes to public APIs
  • post benchmark scores
  • manually test the debug page
  • tagged @mapbox/map-design-team @mapbox/static-apis if this PR includes style spec API or visual changes
  • tagged @mapbox/gl-native if this PR includes shader changes or needs a native port
  • apply changelog label ('bug', 'feature', 'docs', etc) or use the label 'skip changelog'
  • add an entry inside this element for inclusion in the mapbox-gl-js changelog: <changelog>Prevent video sources from entering fullscreen on iOS Safari</changelog>

Copy link
Copy Markdown
Contributor

@avpeery avpeery left a comment

Choose a reason for hiding this comment

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

works! tested on iphone 12 with ios 15

Comment thread src/source/video_source.js
@rreusser rreusser merged commit ba69792 into main Oct 1, 2021
@rreusser rreusser deleted the ricky/fix-ios-video branch October 1, 2021 17:06
stepankuzmin added a commit that referenced this pull request Jan 17, 2023
* Prevent fullscreen video source in iOS (#11067)

Co-authored-by: Ricky Reusser <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants