I have an app that's over a year old and I can't get Chrome to autoplay anymore using video.js
Fiddle:
http://jsfiddle.net/cdeutsch/cjyB3/
I'm guessing something in Chrome changed.
I just confirmed that fiddle works in Chrome 34.0.1847.116 on windows (which amazingly I had open and not updated)
Does not work in 35.0.1916.114 on OSX
Me and our clients got a maybe related problem today. Chrome 35 refuses to play the video at all, but only if the player is embedded in an iframe. The player controls work fine, but refuses to start the playback.
I placed a breakpoint at some .play() lines within video.js, and found nothing immediatly, but after stepping trough the code the video played as normal.
When i removed the breakpoints the video once again refused to play. Even when i right-clicked the video and choose "Play" manually it didnt react.
I am using Chrome Version 35.0.1916.114 m on Windows 8.
This is the exact code i place my breakpoint in (probably old video.js code, it havent been updated for a while):
vjs.Player.prototype.techCall = function (method, arg) {
// If it's not ready yet, call method when it is
if (this.tech && !this.tech.isReady_) { // < If i place breakpoint here, and then continue script execution, the video plays fine
// even within an iframe.
//The check never returns true, it always proceed to the else block.
this.tech.ready(function () {
this[method](arg);
});
// Otherwise call method now
} else {
try {
this.tech[method](arg);
} catch (e) {
vjs.log(e);
throw e;
}
}
};
Edit: Confirm that it works as soon as i turn off autoplay. And i can confirm that it also works after updating videojs to a more recent version (April 8 stable release, if you want to know). Still, curious what Chrome changed from version 34 to 35.
So it looks it's working, but only if you set preload="auto" or remove it altogether if you want to use autoplay. _However_, once you make that change, #1237 comes into play and we see the big play button and no other controls.
AFAIK, preload should be ignored if autoplay is present, but I'm not sure if that's really in the spec of just something most browsers have done. Whatever the case is, it's clear Chrome broke this behavior in a recent version. I'll leave this issue open for now for tracking.
I can confirm I experienced the very same thing, @mmcc's workaround works perfectly fine for now.
It looks like this is fixed in Chrome Canary (37.0.2048.2 canary), so hopefully that makes it back into the main channel. I'm going to close this one in the meantime.
I have Chrome 49 OSX, and autoplay don't work in Chrome for me, but it works in Firefox.
What can I do?
Same problem, autoplay doesn't work on Chrome 49 Windows 8.1.
I'm having the same problem with the latest versions of vjs and chrome.
Having to resort to this at the moment:
window.onload = function() {
document.querySelector('#hero-vid video').play()
}
Same problem for me
Same problem here but it was with mobile Chrome:
Mozilla/5.0 (Linux; Android 5.0.2; AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36
Removing preload doesn't work for me.
Same here...
+1, even if I add player.play() right after creating videojs object, it doesn't work in latest chrome, only firefox.
Videojs 5.17.0
Only this works for me:
setTimeout(function() { player.play(); }, 1000);
you should try using video on local server insted of external link. Auto play workd for me from local server.
On Android, you can autoplay if you put muted option
<video autoplay muted>
<source src="video.webm" type="video/webm" />
<source src="video.mp4" type="video/mp4" />
</video>
Most helpful comment
I'm having the same problem with the latest versions of vjs and chrome.
Having to resort to this at the moment: