We'd like to remind Forumites to please avoid political debate on the Forum... Read More »
We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
MP4 Video not playing in Chrome
Options

scaredofdebt
Posts: 1,663 Forumite


Hi,
Not sure if anyone can help but I have trawled the net without much success.
I am building a website with an embedded MP4 video in a slider, it works OK in Firefox and IE but not Chrome, I have tested in on a laptop, desktop and phone so I know the issue is Chrome.
Any ideas?
I'm not allowed to post links am I?
OK so I am thanks:
http://sweeneydogkr.co.uk/video.html
Cheers for any ideas, workarounds etc.
Not sure if anyone can help but I have trawled the net without much success.
I am building a website with an embedded MP4 video in a slider, it works OK in Firefox and IE but not Chrome, I have tested in on a laptop, desktop and phone so I know the issue is Chrome.
Any ideas?
I'm not allowed to post links am I?
OK so I am thanks:
http://sweeneydogkr.co.uk/video.html
Cheers for any ideas, workarounds etc.
Make £2018 in 2018 Challenge - Total to date £2,108
0
Comments
-
You can post links - lets have a look0
-
Oh, you may need to scroll right as the first thing in the slider is an image, the video should autoplay.Make £2018 in 2018 Challenge - Total to date £2,1080
-
Ok, so your video is there , the issue is that it is not autoplaying ..
I have seen this before in HTML5 and chrome not listening to the autoplay flag here ..
Try a little javascript to make it autoplay ..
Directly after you close the video tag, add this line
<script> document.getElementById('asvideo0').play(); </script>
That should sort you out . If not, then get on google and research the fact that chrome doesnt like autoplaying videos that are not muted - so you may need to add some tags to mute the video (even if it doesnt have sound !!)0 -
Thanks AndyPix, appreciate the help, unfortunately your idea just gives a blank white screen.
But you did give me some other ideas, so far I've got it so Chrome does now show the video but it doesn't autploay it, I've raised this on the Google developers forum but no response as yet.Make £2018 in 2018 Challenge - Total to date £2,1080 -
Thats strange ..
You added the line directly after the </video> tag ?
have you added mute tags like i suggested ? you should add "playsinline" and "muted"
Chrome will not autoplay videos unless they are muted0 -
Yes, this is the code:
<video playsinline autoplay muted controls loop>
<source src="images/sweeneydog.mp4" type="video/mp4">
Your browser does not support the video tag. But you could include an iframe/embeded video here.
</video>
<script> document.getElementById('asvideo0').play(); </script>
I've put it back in if you want to look at the white screen.Make £2018 in 2018 Challenge - Total to date £2,1080 -
OK so this fixed it, thanks to Stackoverflow:
</body>
<script>
var myVideo = document.getElementById("myVideo");
setTimeout(() => {
myVideo.play();
}, 1000);
</script>
</html>
Called the video id "myVideo"
Appreciate your help Andy.Make £2018 in 2018 Challenge - Total to date £2,1080 -
scaredofdebt wrote: »Yes, this is the code:
<video playsinline autoplay muted controls loop>
<source src="images/sweeneydog.mp4" type="video/mp4">
Your browser does not support the video tag. But you could include an iframe/embeded video here.
</video>
<script> document.getElementById('asvideo0').play(); </script>
I've put it back in if you want to look at the white screen.
Yeah - the problem was that you werent tagging your video with an ID , so the script didnt know what element you were referring to.
in your video tag, you should have had id="asvideo0" like in my code snippet and it would have worked.
Anyway you're sorted now - nice work
(I still think my one liner is better than abstracting it though)
0 -
Oh, and you also want ..
document.getElementById("myVideo").controls = false;
So the controls dont appear when you hovver the mouse over the video0 -
Thanks, yes Javascript isn't my strong point!Make £2018 in 2018 Challenge - Total to date £2,1080
This discussion has been closed.
Confirm your email address to Create Threads and Reply

Categories
- All Categories
- 350.9K Banking & Borrowing
- 253.1K Reduce Debt & Boost Income
- 453.5K Spending & Discounts
- 243.9K Work, Benefits & Business
- 598.7K Mortgages, Homes & Bills
- 176.9K Life & Family
- 257.1K Travel & Transport
- 1.5M Hobbies & Leisure
- 16.1K Discuss & Feedback
- 37.6K Read-Only Boards