4

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 !

Shivam Kubde
  • 545
  • 1
  • 8
  • 17

3 Answers3

12

I think 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.

lee-m
  • 2,269
  • 17
  • 29
Vedran
  • 336
  • 3
  • 7
2

Note that I is uppercase playsInline

// Example #1
<video playsInline />


// Example #2
<Player playsInline attr={someValue}>
GMKHussain
  • 3,342
  • 1
  • 21
  • 19
2

In the docs playsinline seems to be lowercase now.