Поддержка Проблемы и решения Проблема с автовоспроизведением видео на iOS

  • Уважаемые знатоки, подскажите, пожалуйста, уже все головы сломали.

    Задача — установить в шапку сайта баннер видео-формата. Вроде бы установили и всё работает, вот :: http://lambada.store/

    Но при просмотре с мобильных устройств на iOS — баннер отказывается воспроизводиться автоматически (на других устройствах проблем нет).

    Я уже было подумал, что дело в самом видео (типа iOs блокирует автовоспроизведение из-за наличия аудиодорожки). Но полностью удалив аудиодорогу и перезагрузив видео — ничего не изменилось.

    Посмотрите, пожалуйста, друзья, в чём может быть проблема?

    Заранее благодарю за любую помощь!

    • Тема изменена 4 года, 11 месяцев назад пользователем roopert77.
    • Тема изменена 4 года, 11 месяцев назад пользователем roopert77.

    Страница, с которой нужна помощь: [войдите, чтобы увидеть ссылку]

Просмотр 1 ответа (всего 1)
  • roopert77, приветствую.

    Но полностью удалив аудиодорогу и перезагрузив видео — ничего не изменилось.

    Можно было не удалять аудио-дорожку, а просто добавить атрибут «muted» к тэгу <video>. Второй момент — читаем официальную документацию тут и видим:

    Enable Video Autoplay

    Video elements that include <video autoplay> play automatically when the video loads in Safari on macOS and iOS, only if those elements also include the playsinline attribute. For more information on inline playback, see Enable Inline Video Playback.

    By default, autoplay executes only if the video doesn’t contain an audio track, or if the video element includes the muted attribute. Video playback pauses if the element gains an audio track, becomes unmuted without user interaction, or if the video is no longer onscreen (either by CSS or due to the user scrolling the page). The video doesn’t pause unless the user clicks or taps the video. This same expectation applies to WebRTC one-way video conferencing. For more information on WebRTC playback controls, see Add WebRTC Playback Controls.

    Autoplay video when the user expects it to autoplay in your website. For example, autoplay video in interfaces where video playback is the purpose of the webpage, like a video-sharing or hosting website.

    Enable Inline Video Playback

    When you want to display short-form content, it is more optimal to play your video inline. Use <video playsinline> to play videos inline.

    Without the playsinline attribute, videos must be in full-screen mode for playback on iPhone. If videos do play in full-screen mode, they will continue to play inline when the user exits full-screen mode, even if the video element doesn’t contain the playsinline property.

    Иногда практикуется использование костыля в виде document.getElementById('video').play();, но это «такое себе».

Просмотр 1 ответа (всего 1)
  • Тема «Проблема с автовоспроизведением видео на iOS» закрыта для новых ответов.