A
A
alexks23kz2021-06-15 11:38:08
iOS
alexks23kz, 2021-06-15 11:38:08

How to remove player from video on iPhone?

The whole point is in the title. Doesn't hide video controls on iPhone. Everything works fine on PC and Android.
60c866d9e030f254252744.jpeg
+ sound is not removed
+ .play() function does not work

<video src="video.mp4" controls="false" loop muted></video>

Styles added
video::-webkit-media-controls {
    display: none !important;
    -webkit-appearance: none;
    opacity: 0
}

video::-webkit-media-controls-enclosure {
    display: none !important;
    -webkit-appearance: none;
    opacity: 0
}

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

video::--webkit-media-controls-play-button {
    display: none !important;
    -webkit-appearance: none
}

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

.custom-video-controls {
    z-index: 2147483647
}

Mini fix in js
var videos = document.querySelector('.slider-video video');
  for (var iv = videos.length - 1; iv >= 0; iv--) {
    let vr = videos[iv];
    vr.controls = false;
  }

And, the actual video switcher in slick.js
$('.slider').on('beforeChange', function(event, slick, currentSlide, nextSlide){
    console.log(slick);
    let currentVideo = $(slick.$slides[currentSlide]).find('.slider__video');
    let nextVideo = $(slick.$slides[nextSlide]).find('.slider__video');
    $(currentVideo).find('video')[0].pause();
    $(nextVideo).find('video')[0].play();
  });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Golubev, 2021-06-16
@bestowhope

And tapping on the screen is not an option?))
No way. The iPhone doesn't care about your styles, etc. He will always put his player. Once I happened to see only 1 player that "overlapped" the iPhone, watched a movie. But everything worked through the izda, they constantly replaced each other, overlapped, twitched, and so on.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question