So I\'m currently building a website that has a carousel containing four videos, each video is triggered to play by hooking in to the Bootstrap 3 carousel\'s slide.bs.caro
Based on the suggestions Ian kindly made, here is my working solution.
Firstly, I changed each video's child source elements to have an attribute data-src
like so:
Then, after performing a mobile check using the script available at http://detectmobilebrowsers.com/ which I modified to include iPads etc (related SO answer here) I simply used the following script to automatically update the src
attribute of each video (if we're on desktop in my case):
var sources = document.querySelectorAll('video#my-id source');
// Define the video object this source is contained inside
var video = document.querySelector('video#my-id');
for(var i = 0; i
And that's it! Nothing loads on mobile devices anymore and I can have fairly granular control over the devices it will or won't load on.
Hope this helps somebody.