问题
I have a website which is able to play mp4 media (via the <video>
tag and via DASH) in every browser except the Samsung Internet browser, which comes as default on Samsung Galaxy phones and probably a lot of other Samsung devices.
On a desktop, iPad, or even an ancient HP TouchPad tablet, it works fine. Using other browsers on the same Samsung device (e.g. Chrome), the mp4 media plays fine, so it's not a limitation of Android or the device hardware.
I can detect the Samsung browser with JavaScript and disable video content on those devices, but I'd really like to not have to do that. Surely there is a workaround.
Here's a quick test, if you'd like to try it on your device. It tries to play 3 slightly different types of mp4 media on one page:
http://2pic.me/dashtest.html
On my Samsung Galaxy S6, none of them play in the Samsung Internet browser.
I tried using video.js, but that did not change the behavior.
Update:
In the year since I posted this, Samsung has finally updated their browser, and mp4 content now plays correctly, including auto-play.
回答1:
I experienced the same issue on Samsung Browser (current latest: v6.2.01.12), on a Samsung Galaxy 7 device. In my case I was using video.js, and playing HLS. The problem I found was that autoplay was not working. My solution was to try to play the video programatically and if failure detected (promise rejection), then display a PLAY button, and play the video in the user click. That worked for me. It would be something like:
const video = document.getElementById('my-video');
video.play()
.catch((err) => {
if (err.name === 'NotAllowedError') {
// Display PLAY button with a click event listener and play the video there.
}
});
This is a simplified code, I do specific checks to see if my-video is an actual <video>
element, and if video.play()
returns a promise and all the basic safe checks (since this is supported in many other browsers).
But, it shows the idea to handle this autoplay not working scenario.
I hope it helps!
回答2:
Samsung's mobile browser does not appear to support HTML5 Media Source Extensions (MSE) at the time - these are required for DASH playback.
You can test for MSE support on a browser using several online links, such as:
- https://bitmovin.com/browser-capabilities/
回答3:
It is working for me fine, you can use mute if more than one video need to play check this:
<pre>
<video class="video" webkit-playsinline="" playsinline="" muted="" autoplay="" loop="" preload="auto" width="100%" height="auto" controles="">
<source src="wp-content/uploads/talkforweb.com.au.mp4" type="video/mp4">
</video>
</pre>
来源:https://stackoverflow.com/questions/47599205/mp4-content-wont-play-in-webpages-served-to-samsung-internet-browser