Due to a fairly recent update, Chrome no longer will autoplay media content such as video if it tries to start in a tab or window which does not have focus.
There are a few sites, including my own - which rely on switching then playing videos in the background as a music player. This has been broken by Chrome, with their idea being that it prevents annoying videos from playing.
I'm reluctant to even consider building a chrome extension to circumvent this (if that would even work), but would like to hear how if possible. Is there any way to get around this annoying issue?
edit: according to this reddit post it may not be Chrome, but YouTube's chrome specific implementation...
edit2: this Chrome issue states that “Once a tab / RenderFrame has ever played media before, it’s allowed to continue to autoplay/autoload indefinitely; this is to support playlist type applications.” - Perhaps if somehow a 'RenderFrame' contains all future media which is also loaded by AJAX this will work... whatever a render frame is (Since as noted in the comments, a page reload/change does not count as the user having allowed autoplay.)
Related
I've tried to find a workaround to autoplay video with sound on and found a couple, but none of them are works for me. Also I've found a tons of replies that this is not possible to autoplay video with sound on, but in the same time I saw a lot of video ads that start playing automatically with sound. So seems like there is a way to make it happen at least for advertisers. I heard about whitelist for websites which are allowed to autoplay with sound such as youtube, but I guess this is not the case for ads. So, does anybody know how could it be implemented that way?
this is the real reason
https://blog.google/products/chrome/improving-autoplay-chrome/
Chrome does this by learning your preferences. If you don’t have browsing history, Chrome allows autoplay for over 1,000 sites where we see that the highest percentage of visitors play media with sound. As you browse the web, that list changes as Chrome learns and enables autoplay on sites where you play media with sound during most of your visits, and disables it on sites where you don’t. This way, Chrome gives you a personalized, predictable browsing experience.
As you teach Chrome, you may find that you need to click “play” every now and then, but overall the new policy blocks about half of unwanted autoplays, so you will have fewer surprises and less unwanted noise when you first arrive at a website. The policy is enabled in the latest version of Chrome—update today and try it out.
https://developers.google.com/web/updates/2017/09/autoplay-policy-changes
A while back, Chrome changed their autoplay policy so that you can't autoplay a video unless it is muted, or the user has interacted with the web page.
I use HTML5 video as part of a digital signage application, but it's common that the page is never clicked - for example when launched automatically in Kiosk mode.
If I mute the video it can autoplay, then if I bind to the play event and try and unmute it causes the video to stop playing (I guess they thought of that). I've had no other luck with similar trickery.
I understand the reasoning behind this behavior and on a website it makes sense - but mine is not a website, it's an application.
Is there a way around this? For example, if I moved to being a Chrome Application/Extension would the policy no longer be enforced? I'm somewhat stumped and would appreciate any insight.
(Asking people to go to chrome://flags/#autoplay-policy is not really an option)
If you are able to control the launch of Chrome, then you should be able to launch chrome from the command line, or via a script, with a flag to ask it to ignore the requirement for a gesture - e.g.:
$ chrome --autoplay-policy=no-user-gesture-required
This flag changed recently which may cause some confusion or be relevant if using older versions - see this discussion for some background: https://groups.google.com/a/chromium.org/forum/#!topic/headless-dev/zxPyN5f8MAQ
I've been trying to work on a project to he able to turn loop on and off for the MP3 playing on a we page. I was using <embed> and tried changing the loop= property using a javascript getElementByID, but while the image swap would work, the song would still stay on the mode it was on at page load.
Someone else used the idea to use the <audio> tag, and made a togglefor loop=, and said it worked. I tried, and would not work. I went and tried on an example site, and it worked for OGG, but not MP3.
I researched it, and the only thing I could find was that Firefox didn't originally support MP3s due to LAME copyrights/patents, but started supporting the MP3 format in version 9.
What's even stranger, is that sometimes the player controls show up, sometimes they don't. I have random other information show up on the page on load, so can't say if it's random when it shows up, or related: but even when the controls load, the play button never works, and it doesn't start on autoplay. However, in Chrome, it loads up fine.
So to condense, when in IE, it loads the text to say it's not compatible with my browser, meaning I can have an <embed> for if it doesn't work: I just tried it.
Firefox, on the other hand, acts like it WILL load it, and doesn't show the alt text.
I read about some people having trouble with OGGs, talking about a MAME type, but I don't really know anything about that stuff, yet...
I'd really like some ideas on what to do about this, because it doesn't ever even show the text to say it's not supported, it's like nothing's there in FF/CB, and MP3s SHOULD be supported for the past 4 full versions, which I'm assuming is why it doesn't say it's not supported.
Firefox doesn't support MP3 in <audio>, precisely because it's still patented... I have no idea what made you think it's supported in Firefox 9.
I'm using jQuery to dynamically write <video> objects, and running videojs to init them. After I play a video, SOMETIMES when I try to play it again, it just won't play, and from that point on, even after refreshing the page, no videos will play. Each time, the <video> object renders, but the video just doesn't play. Nothing is written to the console. There don't appear to be any errors. Restarting Chrome resolves the issue, but only momentarily. After playing a few videos, the issue comes back again.
I found that closing other tabs in Chrome does indeed fix the problem, so it appears to be some kind of memory issue.
I'm running Chrome 19.0.1084.46
Exactly how many video tags to you have? What do they look like? Do they include preload='none' attribute? Are the source videos all on the server?
I ask because if you have more than six video tags on a single page pointing to the same source server then you could be experiencing "connection starvation":
Chrome allows only six open connections to a single server (based on DNS name in the URL)
the html5 video tag's preload attribute default value is 'auto'
Chrome's auto behavior is to preload some data and leave the connection open ready to pull more data for the video
So, with more than six video tags on a single page pointing to a single server, the videos will not play. To resolve this particular problem, set the preload attribute to 'none'
Stu is correct. But sometimes, in my experience, Chrome ignores the preload="none" attribute and goes ahead and opens a connection anyway. I've had much problem with this when developing a site which had many smaller videos on it. The connections blocked the rest of the content (images, custom fonts (and when custom fonts are delayed, the text does not even render)) My solution was to build an own preloader which loads the images. This made sure I could control at least when the images (which was the most crucial aspect from a design point of view) was loaded.
That solved the problem with images not showing but the problem still remained. So the best solution is to set up subdomains pointing to the same server, like: v1.server.com, v2.server.com, and so on. This means you won't have to move your files and you get the benefit from enabling browsers to have more open connections. Watch out for increased dns lookup time though.
There is a known bug with Chrome. It will not play the same video in multiple tabs at the same time. This is probably what you are running into if you are a developer and happen to have your page open in two tabs at the same time.
The bug has been known for almost 5 years as of this writing. Feel free to visit the Chromium bug report and star the issue. Hopefully it will increase in priority for the Chrome devs.
In the meanwhile, a workaround is to use a random query parameter in your video src. For example, instead of <video src="vid.mp4">, use <video src="vid.mp4?_u=1253412">. This will break Chrome's caching mechanism and allow the same video to be streamed to two different tabs at the same time.
I had a similar but related issue which I can expand on slightly here.
I had 14 different small videos on a page but only 2 were available at a time. Setting preload = 'none' didn't fix the issue so I also used a data attribute to store the src, and remove the src for all videos that aren't currently being viewed.
I'm setting up a website which ultimately displays videos. The video files are all .mpg and requirements prevent me from converting these to another format such as flv. So far I have been playing around with Windows Media Player but have found that it doesn't play nice with non IE browsers. The problem which arises is that although the video will play, it doesn't shrink itself to fit in the WMP container and so only the top corner is visible. This problem goes away if I download the np-mswmp plugin for Firefox however it is a manual install and I'd rather not leave it to the user. Once the Firefox plugin is installed, Chrome also plays the files correctly but I doubt that the average user would ever think to do this.
Is there a better way to embed .mpg files into a web page, an alternative player which doesn't require file conversion? I have had a play with Quicktime but it only ever shows a Q with a question mark imposed over it, even when I associate Quicktime with .mpeg files. Any advice would be appreciated!
Thanks,
James
I'm sorry to say there isn't a good way to do cross-browser video without being able to force your users to install something. That is why every video site uses flash, since it's the nearest thing to a standard - but of course flash has some gaps in coverage, the most significant being iPhones.
Windows Media Player has only about 70% penetration and Internet Explorer somewhat less. By going this route you will end up with 1 in 3 users unable to view your videos.
Either bite the bullet and move to Flash as a video player or just give your users a download link. A download link is a very easy way to support almost every user, if you can do that.