I am trying to grab a video URL from data-src
and add it to src
for my video. I have that much working when I snoop the page code but the video isn't showing up on the page and playing. I'm using jQuery since I have a few other bits of code using it to run some functionality.
Markup:
<video autoplay="autoplay" loop="loop" poster="/assets/video/bg-ss-vid.jpg"><source type="video/mp4" data-src="/assets/video/bg-ss-vid.mp4"></video>
jQuery:
jQuery(document).ready(function ($) {"use strict"; $("#site-hero video").each(function () { $('source', $(this)).attr("src", $('source', $(this)).data('src')); $('source', $(this)).removeAttr('data-src'); });});
How do I get it to show up / play the video after the src
has been loaded?