SOLVED: Background video not auto-playing on iPhone

Browser: Safari
OS: iOS
URL: https://connect-education.co.uk
Video: N/A

Hello,

The background video for our hero section is a self-hosted MP4 video. It plays on desktop, tablet, and Android devices. However, it seems that the video is not playing on iOS/iPhone.I’m completely at a loss, and I’ve looked at several posts on the subject and can’t seem to find anything that has worked.

I don’t have any iOS devices to test with, so I’m having to reach out to colleagues to test, which is a little tedious, so I’m hoping I’m just missing something obvious.

Here are the settings from bricks:

There is a background image also that is a still from the video, that shows when the video does load or play.

Thank you in advance for any help and guidance you can provide!

Best wishes,
Markus

Hi Markus,

I suppose you have enabled Low Power Mode on your iPhone. Try to turn it off and video should work.

1 Like

I don’t have an iPhone to check that, let me reach out to a colleague (we all work remotely) and see if that is something they have turned on - thank you for the help!

Hi @TRD_Markus,

Thank you for your report. We have identified a bug that should be addressed in our next release regarding videos not playing on mobile.

But I’m curious how it’s working on Android but not iOS for you.

Best regards,
Charaf

1 Like

Hi @charaf ,

My colleague came back to me like 3 minutes after your reply, and it is still not working on iPhone. I have tested the website on two Android devices, and it runs perfectly on both of them. One of these devices is an older Android 7 phone, which, as mentioned before, plays the background video without any problems.

I look forward to a fix in the next release :nerd_face: .

Best wishes,
Markus

1 Like

Hi Markus,
We’ve fixed this issue in Bricks 1.8.5, now available as a one-click update in your WordPress Dashboard.

Please let us know if you are still experiencing issues.

Best regards,
timmse

1 Like

Amazing I’ll get the site updated now, and see if I can get someone to retest on an iPhone. Thanks for the update! :raised_hands:

1 Like

Hello again,

Unfortunately, we’re still having the same issue of the video not playing on iOS, although it is still playing on every other platform and device (go figure). Any further advice or guidance would be super appreciated.

Best wishes,

Markus

Hi @TRD_Markus,

Can you please share a URL so I can look into this?

Thank you.

Best regards,
Charaf

Hello,

Absolutely, it’s the same website listed in my first post, and it’s the video that is in the hero of the homepage.

Best wishes,

Markus

Hi Markus,
It could be because the video has an audio track (without sound, but iOS doesn’t know that).
Please remove the audio track completely in a video editor of your choice and see if it works.

In my test, it works fine with the same video (after removing the audio track). Side note: Do you really want to use a 27MB video as background video?

Brilliant, thank you, it was the audio track as you pointed out. We’ll look to reduce the video file size asap. Thank you! :smile:

I can tell you what worked for me, what i did was this disabled autoplay of videos on your iPhone, depending on what you’d like to control. Here are two ways to do it:-
1. Stop Auto-Play Video Previews:- This setting applies to most apps and websites that show video previews. Here’s how to turn it off:-

  • Open Settings.
  • Scroll down and tap on Accessibility.
  • Tap on Motion.
  • Find the toggle for Auto-Play Video Previews and turn it off.

2. Stop Autoplay in Specific Apps:- While the above setting works for most scenarios, some apps like YouTube might have their own autoplay controls within the app itself. You’ll need to check the app’s settings to disable autoplay there. Here’s an example for YouTube:-

  • Open the YouTube app.
  • Tap on your profile picture in the top right corner.
  • Select Settings.
  • Go to Playback.
  • Under Playback in feeds, choose Off.
  • You can also disable autoplay for the next video in sequence by toggling off the Auto-play next video option under Playback.

By following these steps, you can gain more control over video autoplay on your iPhone.
Follow for more informatics assistance below.

for sure that worked
To improve compatibility, particularly with Chrome on mobile, consider using a combination of click, touchstart, and touchend events, and possibly including a small delay before trying to play the video. Here’s an enhanced version of your code:

try working with this code pls

$(document).ready(function() {
function playVideoOnInteraction() {
const videoElement = document.getElementById(‘home_video’);
if (videoElement && !videoElement.playing) {
videoElement.play().catch(function(error) {
console.error(‘Autoplay prevented:’, error);
});
}
}

// Listen for both click, touchstart, and touchend events
$('body').on('click touchstart touchend', function() {
    playVideoOnInteraction();

    // Optionally, unbind the event after the video starts playing
    if (document.getElementById('home_video').playing) {
        $(this).off('click touchstart touchend');
    }
});

});

  • touchend Event:
  • Added touchend to the event listener. In some cases, Chrome might respond better to touchend rather than touchstart because it ensures the touch gesture is complete.
  • Handling Autoplay Restrictions:
  • The .catch(function(error) { ... }) block catches any errors that occur if Chrome or another browser prevents autoplay, providing feedback in the console. You can also use this to display a message to the user if needed.
  • Enhanced User Interaction:
  • By responding to both touchstart and touchend, the script increases the chances of being considered a valid user interaction across different browsers, including Chrome.

Hi
I too am facing the same issue but the video I added don’t have any soundtrack but still in Iphone its not playing.
The video however is playing in all android,desktop and even in MacBook only IPhone is giving issue.
Can someone please look into this?