Shivam Kubde
Shivam Kubde

Reputation: 623

Video is not auto playing on IOS by using react-player npm

I want to play video when user comes to the page, it is working fine for all the platform except IOS. I am using react-player npm. I have tried by passing muted property but doesn't work.

My code looks like this

<ReactPlayer playing=true url="video_url" muted loop=true />

Thanks in advance !

Upvotes: 4

Views: 14545

Answers (4)

Sundaran Sundaran
Sundaran Sundaran

Reputation: 1

It need H.264 format and you have to put playsInline in react-player to avoid opening apple video player

Upvotes: 0

Vedran
Vedran

Reputation: 376

You need the playsinline attribute for iOS autoplaying in non-fullscreen, as per https://webkit.org/blog/6784/new-video-policies-for-ios/:

On iPhone, elements will now be allowed to play inline, and will not automatically enter fullscreen mode when playback begins. elements without playsinline attributes will continue to require fullscreen mode for playback on iPhone.

react-player supports it as a prop.

Upvotes: 15

Anton Kouliavtsev
Anton Kouliavtsev

Reputation: 99

In the docs playsinline seems to be lowercase now.

Upvotes: 3

GMKHussain
GMKHussain

Reputation: 4661

Note that I is uppercase playsInline

// Example #1
<video playsInline />


// Example #2
<Player playsInline attr={someValue}>

Upvotes: 2

Related Questions