Enable autoplay HTML5 video in chrome - android

In my project, I need to autoplay HTML5 video in browser when page is loaded.
I have tried a several javascript solutions but none of them works.
I read that android browser is blocking autoplay due to protect from downloading a lot of data.
Can be this blocking feature turned off in browser/chrome/operation system settings ?
I cannot find any working solution how to enable autoplay. I have searched over plenty of stackoverflow posts and many other sites ...
By the way, I am using android 4.1.1.

Short answer: No.
Longer answer: We are looking at it, but the reason it is turned off by default is that we are really concerned about the battery and bandwidth on a users mobile device that we would rather require the user to perform a gesture.

In Chrome this seems to be working now, anno 2017: HTML5 videos play automatically in Chrome (59) on Android (7.1.1).
Note that the videos start muted. You can enable autoplay with sound on Android Chrome by navigating to chrome://flags and set gesture requirement for media playback to disabled (per this answer).
(Note that unfortunately disabling this flag seems to have no impact on an embedded YouTube video. I have openened a new question for this.)

add "muted" attribute in video tag like;
<video autoplay muted>
...
</video>
it will work. Google chrome doesn't autoplay the videos with sound. So, you will need to mute it.

Related

Chrome 64 Mobile Android not preload and not autoplay muted videos

We encounter issue with Chrome 64 video element which not loaded and not autoplay although we used video attributes preload="auto" and muted on HTML element.
the video start load and paused, after research, we discovered it never starts to play, like the browser blocked it from playing.
our video doesn't have sound, no sound channel at all, and still no autoplay.
Chrome 63 working great and the same device with 64 stop autoplay.
we did all the things Google Chrome wrote in the release notes, but we think there is another issue we don't know about.
We discover that you need to add preload="auto" as HTML element attribute, but you also must put on JavaScript HTML element videoElement.muted=true as normal JS attribute.
it looks like a bug in Chrome.
Make sure data-saver is disabled. If data-saver is on, it will not load video.

Playing Videos Across Multiple Browsers/Devices In Popup?

I have a landing page that has a few sections on it. Each section has a button that when clicked, I would like a video to pop-up and play in a modal-type window.
I have a few questions based on all of this so far.
The videos are handed to me in .m4v format, which I'm handling through html5 as:
<video id="delivervideo" width="100%" height="100%" controls>
<source src="#Url.Content("~/Content/videos/DeliverSection.m4v")" type="video/mp4">
Your browser does not support the video tag.
</video>
This is actually embedded in a Bootstrap Modal, and looks quite terrible on any non-PC device (appears on the top of the screen and cut-off).
When I start playing the video, if I skip ahead using the built-in controls, the video simply stops. I am unable to start the video again unless I refresh the page and start the video over.
So my questions are sort of broad here, but they are essentially:
When my graphics team is handing me videos, what format(s) should I request so the video works on iOS, Android, Chrome, and IE? Is there a couple of formats I should support? We have a lot of software to be able to change the format of the videos, just unsure on what formats to use
If I'd like to continue opening the video in a pop-up modal-type window, is there a better solution to this than Bootstrap? Something someone here has experience with that works nicely?
Has anyone else experienced issues with the built-in html5 <video> tag controls, where skipping ahead/rewinding causes play-back issues?
I can share the page to someone through PMs if they are willing to take a look, but really nothing out of the ordinary. Just a simple <video> tag supporting mp4 type, while the video is in .m4v format. It only seems to work on Chrome so far, so not very useful to mobile or tablets.
Note, I am using ASP/MVC and the website is hosted in Microsoft Windows Azure as a Website, not a VM where I have control over IIS.

Detect if browser supports autoplay of embedded media - YouTube playVideo() and iOS

What's the best way to detect if a browser supports autoplay of embedded media files?
Using the youtube javascript API, on iOS (and possibly Android) devices, if you call playVideo() prior to the user tapping on the video, the video is put in a bad state and is basically useless. You might do this when you want to autoplay the video after the page loads, or you might have your own play/pause button.
There are lots of discussions on how to get autoplay to work (see below), but another way to deal with this is to detect when it shouldn't be called. The obvious answer would be to detect a specific device or OS using the user agent string, but I'm wondering if there's a better way to do it.
Related posts:
YouTube iFrame API hangs in buffering state after the playVideo() command on iPad
Can you autoplay HTML5 videos on the iPad?
Autoplay an Audio File on Mobile Safari
How can I autoplay media in iOS >= 4.2.1 Mobile Safari?

Autoplay attribute for HTML 5 in android devieces

I am trying to integrate an HTML 5 video player with It's auto-play attribute on my site. It is working fine on Web and other devices but it is not working with any android device which has 4.0 and above OS. I have seen this Link.But I am looking if there is any workaround for this issue.
Note:I have also tried implementing jwplayer but later on I found that it doesn't support the autoplay for android and ios devices.
PS : I have tried to put an image on top of video and clicking on that should trigger an autoplay but still no success.
The only approach I know of is to provide a user interaction before the video begins to play like a 'touch to enter site' button, then on that event play the video. Playing video or audio in HTML5 requires user interaction on Android and iOS. It is by design - no workaround as of today is available. You can read here for confirmation.
You can read here for the whys and hows on iOS (which is the same info as on your Google link).

Video playback capabilities in iOS and Android

I'm in the stage of planning a new application for both iOS and Android platforms (tablet and phone), which will heavily feature streaming video playback.
However, the documentation is not entirely clear about capabilities of these platforms when it comes to video playback. So my questions are:
1.) Can Android and iOS playback HTML5 video from a webpage/webview?
2.) Can HTML5 videos be shown as part of a webpage (non-fullscreen) with an overlay?
3.) Can Android and iOS play videos natively in non-fullscreen mode?
4.) Can I do text/graphcs overlay over a played video if it's a part of native app?
The answers on these questions (if possible, with supported OS versions) would be much appreciated, I can't seem to find conclusive resouces as part of the platform documentation.
Ok let me try to answer as clear as possible since I just had experience with apps for streaming in ios and android.
1.) Can Android and iOS playback HTML5 video from a webpage/webview?
Yes The both can with the <Video> tag
2.) Can HTML5 videos be shown as part of a webpage (non-fullscreen) with an overlay?
This depends more on the device than on the OS. iPad can do it without full-screen but iPhone does apply full-screen, Android Tablets Can some Andorid phones Can't.
Specifically on iOS and iPhones the best way to go would be to create a MPMoviePlayerController (not to be confused with MPMoviewPlayerViewController) and you can set the layout in your viewController and restrict the size of the video so you can see the layout. (This allso works of course in iPad so that could be your best approach for both)
3.) Can Android and iOS play videos natively in non-fullscreen mode?
Yes they can, as explained above would be better if instead of using a WebView you use VideoPlayer's in View Controllers
4.) Can I do text/graphcs overlay over a played video if it's a part of native app?
You can using the above approach since your video will be on your viewcontroller where you manage the size and position of the player in your view, when doing it on a webviewthe device automatically loads the player so you are unable to manage it.
You should play safe and go for min OS requirements iOS 4.0 and Android OS 2.1 because of the improvements both versions made on native video playback
I don't think there can be a definitive answer without testing and even then the answers are likely to change (rapidly, I hope). I looked at the reference video here: http://broken-links.com/tests/video/ which is encoded in three different forms, ensuring it can play correctly in Firefox, which supports ogg, Chrome, which supports webm, and whatever supports m4v.
<video id="video" autobuffer height="240" poster="../images/bbb_poster-360x240.jpg" width="360">
<source src="../media/BigBuck.m4v">
<source src="../media/BigBuck.webm" type="video/webm">
<source src="../media/BigBuck.theora.ogv" type="video/ogg">
</video>
I tested this on an iPad 2 with the latest updates, a Samsung Galaxy Tab with Android 3.1, and a Nexus One with Android 2.3 as well as Firefox 5 and Chrome 12 on OS X 10.6.8. Both Firefox and Chrome played perfectly.
Ipad 2: Played correctly in the browser (non-fullscreen). The only anomaly: time was shown as "1' of NaN'"
Android 3.1: Played correctly in the browser (non-fullscreen.)
Android 2.3: Went to full-screen when I pressed "play." After playing, went back to in-browser, but showed time as "1' of 6000'" Also, it hung for a while before playing, perhaps because of the connection speed, but it didn't feel completely stable.
I hope this is helpful.

Categories

Resources