reactjshtml5-videoreact-player

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 !


Solution

  • 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.