Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iPhone displays double controls #3762

Closed
marinaglancy opened this issue Nov 9, 2016 · 21 comments · Fixed by #7634
Closed

iPhone displays double controls #3762

marinaglancy opened this issue Nov 9, 2016 · 21 comments · Fixed by #7634
Labels
pinned Things that stalebot shouldn't close automatically

Comments

@marinaglancy
Copy link

marinaglancy commented Nov 9, 2016

I decided to separate this problem from #3761 because I can suggest a patch for this one.

Problem: Videos on iPhone have double controls - one native and one provided by Video.JS.
There is no difference if I set "nativeControlsForTouch": false or not (as suggested in #3305).
Specifying a poster on the video hides the play button but still does not hide the controls when you click the video in non-fullscreen mode. I suggest you to add this to standard Video.JS CSS something like that:

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

Example: http://prototype.moodle.net/media/videojs1.htm (without custom CSS)
http://prototype.moodle.net/media/videojs2.htm (with custom CSS)

I have created an issue in Moodle tracker https://tracker.moodle.org/browse/MDL-56829 too

@mister-ben
Copy link
Contributor

@marinaglancy I think so but to confirm, this is also resolved by using playsinline?

@marinaglancy
Copy link
Author

Double controls do not appear on ios 10 when using playsinline attribute, but since it's not a default attribute (and actually an optional one), I believe, videojs should address this in the player. Double controls can't be hidden on ios 9 at all.

On previous versions of ios, if I remember correctly, only native controls are displayed.

@davidwilde
Copy link

+1
I also see the issue of double controls in ios. My use case requires to not have the playsinline attribute set because I need to enter fullscreen mode on playing event.

@aqzhyi
Copy link

aqzhyi commented Dec 30, 2016

I also see the issue of double controls in iPhone6s plus with ios 10.2.

FYI, I use

video::-webkit-media-controls-panel-container {
  display: none !important;
}

to hide it.

it works.

@daslicht
Copy link

daslicht commented Jan 9, 2017

@Pleasurazy It has no effect here on an iPhone 7 :/

<video playsinline>

seams to work.

@DieterPagel
Copy link

Does anyone perhaps have a working code example for me on how to play video inline on iOS? We have read extensively in the forums and tried all suggestions but we just can't seem to get it to work

@gkatsev gkatsev added the pinned Things that stalebot shouldn't close automatically label Jul 2, 2018
@verybluebot
Copy link

none of the above solutions worked for me. still seeing video.js and native browser controls on IOS 13

@gkatsev
Copy link
Member

gkatsev commented Aug 6, 2020

@verybluebot can you provide more details? I don't actually see double controls anymore and haven't for a while.

@gabycperezdias
Copy link

gabycperezdias commented Aug 27, 2020

I had to use @marinaglancy 's solution with the css and also the playsinline prop to have videojs working as it should...

I am currently using videojs inside a react app, so I have this scenario:

 <div data-vjs-player>
   <video ref={(el) => this.videoRef = el} className="video-js" playsinline />
  </div>

But to really make it work, I had to use the playsinline in the video tag AND in the videoJsOptions passed as the second param on videojs(this.videoRef, videoJsOptions, function onPlayerReady() {})

Trying on Safari / iPhone 8 / iOS 13.6

@verybluebot
Copy link

@gkatsev Im using a IOS WebKit from RN (which don't really should matter) to open the videojs on mobile (served from my server)
still seeing the controls after adding to my html/css (on the server)

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

adding the boolean property <video playsinline>

@arcticmatt
Copy link

The only way I could get this to work was by specifying playsinline on the video element. Which is not ideal because on mobile I'd like the video to be displayed full-screen when it's played.

@simplexx
Copy link

Is there a solution for this? I do not want to use playsinline, same as @arcticmatt

@storyguy88
Copy link

storyguy88 commented Feb 3, 2022

Same as @arcticmatt and @simplexx . The very reason our team came to this thread is because we don't want playsinline. We want full screen video playing on iOS, but after closing a full screen video, you should not see the native controls behind the custom controls.

IMG_1411

@simplexx
Copy link

simplexx commented Feb 3, 2022

As far as I know, there are only two solutions currently to fix this problem, both are not elegant. First one is playsinline, as discussed already. Second one is to detect the browser via javascript and if it is mobile safari, implement some logic to hide the videojs controls and only use the native controls.

Apart from that, there is no solution currently (please correct me if I am wrong).

If somebody has some code for solution 2. - Would be nice to have it here as a reference.

@storyguy88
Copy link

Also confirming that Solution 2 would solve the duplicate controls, but it does not achieve what we want. We want to only display the videojs controls. Hide the native controls at all times except in full screen.

playsinline achieves this perfectly.

If you don't want to use playsinline (due to wanting your videos automatically to play in full screen on iOS), I have not found a solution. Without playsinline, the native controls seem appear in the minimized state no matter what .

@simplexx
Copy link

simplexx commented Feb 4, 2022

@storyguy88 The only additional solution I can think of is to change the approach to using playsinline, and then making the video parent container fullscreen on video play. This way, videojs could be used in pseudo-fullscreen, all without native controls. Did not try this yet though, but I am pretty sure it's possible.

@mister-ben
Copy link
Contributor

Option 2 is the nativeControlsForTouch option.

I've not been able before, but testing now I can reproduce this consitently if swiping down to exit, but still not using the close button. It's a Safari bug that's adding the native controls unasked for, but disabling controls on the video el on exiting fullscreen will work around it.

@storyguy88
Copy link

storyguy88 commented Feb 4, 2022

@mister-ben I'm hoping my research documented below confirms your approach.

The following can be summarized as the following:

On iOS:

  • When not using playsinline, video automatically plays in full screen. < Expected
  • When full screen video is closed using the CLOSE button, video returns to small size, displaying only the VJS controls. < Expected
  • When full screen video is closed using SWIPE DOWN, video returns to small size, but suddenly the controls attribute is added to <video class="vjs-tech" controls... resulting in the native controls appearing in addition to the VJS controls < Not Expected

If controls was never automatically added to <video class="vjs-tech" ...> upon closing the full screen video by swiping down, then the problem would be solved.

Looking for a solution to override and force the controls attribute to always be removed.


Screenshots

Screen Shot 2022-02-04 at 10 11 58 AM

Screen Shot 2022-02-04 at 10 12 11 AM

Screen Shot 2022-02-04 at 10 12 33 AM

Screen Shot 2022-02-04 at 10 12 54 AM

Screen Shot 2022-02-04 at 10 13 12 AM

Screen Shot 2022-02-04 at 10 13 28 AM

@mister-ben
Copy link
Contributor

Thanks for the detail!. That matches what I'm seeing. Could you try out this and see if that's fixing it for you? It does on Simulator and the one iPhone I have to hand.

https://deploy-preview-7634--videojs-preview.netlify.app/sandbox/index.html

@storyguy88
Copy link

Confirmed @mister-ben ! On my iphone, whatever is happening in that sandbox is exactly as expected. Video plays full screen (no playsinline) which is good, and when it's not full screen, I only ever see videojs controls, no native controls. Bravo!

@videojs videojs deleted a comment from baroodandar123 Feb 7, 2022
@storyguy88
Copy link

Hey @mister-ben , great work on #7634 ! Is that merge-able? We're excited to use it.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pinned Things that stalebot shouldn't close automatically
Projects
None yet
Development

Successfully merging a pull request may close this issue.