Ilja Leiko
Ilja Leiko

Reputation: 638

HTML5 video tag doesn't work on mobile

I have TV video stream (which is apparently mpeg-ts stream), if I use html5 video tags it all works find on win/mac machines using Chrome.

<video id="player1" width="640" height="360" preload="none" controls playsinline webkit-playsinline>
<source src=""http://192.168.1.72:9981/stream/channelid/2013555866?ticket=388550710ddf21ad5c6ffd61fcd3d0dc24cf46d2&profile=matroska type="video/webm">
</video>

But that doesn't work on Android tablet nor on iOS.

I have tried installing multiple different JS player, such as mediaelement, plyr, video.js, mpegts... And I have installed like all three browsers on Android tablet - Chrome, Opera and Mozilla for testings. Every single JS player works fine if I watch the video from my laptop (Chrome), but none of them works when I access from Android device.

The furthest I can get is using Opera+plyr(or video.js) to get an audio playing fine, but with a black screen, no video.

Upvotes: 4

Views: 18716

Answers (7)

user27834799
user27834799

Reputation: 1

For me, the problem was solved by removing the source tag belonging to the video tag and assigning the src attribute to the video tag. Before changing, the problem only occurred on Android mobile devices, but after changing, Android, iPhone mobile and PC all worked fine.

Upvotes: 0

abxlayedev
abxlayedev

Reputation: 1

For me the problem was the format of video. Basically the format was m4v, I convert the video to mp4 video. And the mp4 video was not working, but the m4v video was working. The mp4 format was working on my laptop (safari and chrome and on my iphone (safari and chrome) but not on my android phone (chrome). The m4v was working everywhere.

My video tag (with React js) : <video width={250} autoPlay loop muted playsInline controlsList='nodownload' tabIndex={"-1"} style={{borderRadius: '10px'}} src={"VIDEOLINK"}>

Maybe you should check the format of video and use the original format video if you can.

I hope it will help.

Upvotes: 0

Arash Masir
Arash Masir

Reputation: 205

If you're using a separate host for your files, its server should have a valid SSL certification like my case. My android video player did not work until I added a certification.

Upvotes: 0

Gcamara14
Gcamara14

Reputation: 538

Video tag doesn't work on mobile. What I've seen people do lately is use gif's as the poster of the video on mobile. I would also look into tools like Wistia for extra video support. Gifs work on mobile, but as the video assets, they take a while to load since they're usually big.

I don't recommend self-hosting as you won't have a ton of support such as slowly loading the video or dynamically switch from 320p version to HD version as it loads, etc.

For example https://wistia.com/learn/marketing/boost-engagement-with-gifs

Upvotes: 0

Hiren Pipariya
Hiren Pipariya

Reputation: 80

This might work for you. It works fine for me.

<video  autoplay="autoplay" loop="loop" muted defaultMuted playsinline>

Upvotes: 1

user9453652
user9453652

Reputation:

I would try enabling controls as on iOS if your video is supposed to start automatically it will not allow it.

Another thing is to try adding an HTTP Range Header, it helps to split video into byte ranges which is something to take into mind with mobile. This is more for iOS in general but take a look at this link: http://fdiv.net/2013/05/17/getting-html5-video-work-ios-mobile-safari

Also as mentioned by other check the format of your video you should ALWAYS have multiple types available.

Upvotes: 0

ZackAttack
ZackAttack

Reputation: 126

add this as your video starting tag and it will autoplay for android and safari mobile :

<video autoplay="" muted="" loop="" playsinline="" id="vid" preload="auto" width="100%" height="100%">

you also need mp4, ogv and webm formats for crossbrowser

Upvotes: 1

Related Questions