muxinc / elements

Custom elements for working with media in the browser that Just Work™
https://elements-demo-nextjs.vercel.app
MIT License
254 stars 47 forks source link

Bug: Not able to hide play/pause when on an iphone browser in full screen #505

Closed hopegipson closed 1 year ago

hopegipson commented 1 year ago

Checklist

Which Mux Elements/Packages has a bug?

Mux Player React / mux-video

Which browser(s) are you using?

Any browser on an iphone. This has primarily been tested using Safari on iOS and Chrome on iOS.

Which operating system(s) are you using?

iOS

How are you using Mux Elements?

npm package

Describe the bug

Using MuxPlayer from @mux/mux-player-react/ as a Component, we are styling it by hiding the center controls, play button, and gesture layer when it is being used for stream type 'll-live'. The pause button is hidden on a laptop even if you access full screen, as intended. However, when utilizing the MuxPlayer in this exact scenario on an iphone, if you access full screen or picture in picture, the pause/play and seek forward back ten seconds buttons appear again. In the past when dealing with iphone controls like this we could do something like:

video::-webkit-media-controls-start-playback-button {
  display: none !important;
}

To hide that play button that appears by default on the

Steps To Reproduce

  1. Add an instance of the Mux React Player Component to a page - here are our example settings:
    <MuxPlayer
              nohotkeys
              playsInline
              autoPlay
              streamType={'ll-live'}
              muted
              playbackId={'FuJSYrK0014ec2LPnm11bzC2MAySAQPqA'}
            />
  2. Add css to hide the play button:
    mux-player {
      --center-controls: none;
    }
    mux-player::part(play button){     
      display: none;
    }
    mux-player::part(gesture-layer) {
      display: none;
    }
    mux-player::part(vertical-layer) {
      background-color: transparent;
    }
  3. Check out the sample video component on an iphone - the play button is hidden but open hitting fullscreen or PIP, the play/pause button and seeking buttons reappear.

Link to code example: https://codesandbox.io/s/goofy-tdd-lk42fc

The current behavior

Pause and seeking behaviors are still shown when fullscreen or PIP on an iphone browser. Picture attached: File (2) (1)

The expected behavior

We are able to hide pause/play, seeking controls even when a viewer is on an iphone in fullscreen.

luwes commented 1 year ago

@hopegipson thanks for the feedback. I did a quick test but it's not possible to hide any video controls in fullscreen on iOS.

it used to be possible with older iOS versions but nowadays I believe they prevent you from overriding CSS.

if you somehow get it to work with a native video tag and show an example link to a demo I'm happy to look at this again.

Cheers!