使用 react-player npm 无法在 IOS 上自动播放视频
Video is not auto playing on IOS by using react-player npm
我想在用户访问该页面时播放视频,它在除 IOS 以外的所有平台上都运行良好。
我正在使用 react-player npm。我尝试通过静音 属性 但不起作用。
我的代码是这样的
<ReactPlayer playing=true url="video_url" muted loop=true />
提前致谢!
我认为您需要 playsinline
属性才能在非全屏模式下自动播放 iOS,根据 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.
注意我是大写playsInline
// Example #1
<video playsInline />
// Example #2
<Player playsInline attr={someValue}>
我想在用户访问该页面时播放视频,它在除 IOS 以外的所有平台上都运行良好。 我正在使用 react-player npm。我尝试通过静音 属性 但不起作用。
我的代码是这样的
<ReactPlayer playing=true url="video_url" muted loop=true />
提前致谢!
我认为您需要 playsinline
属性才能在非全屏模式下自动播放 iOS,根据 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.
注意我是大写playsInline
// Example #1
<video playsInline />
// Example #2
<Player playsInline attr={someValue}>