Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 'playsinline' attribute (alongside existing 'webkit-playsinline') #148

Closed
GordanRatkovic opened this issue Jan 30, 2017 · 6 comments
Closed

Comments

@GordanRatkovic
Copy link

GordanRatkovic commented Jan 30, 2017

Is there any particular reason why only webkit-playsinline in set and not playsinline as well?

@cookpete
Copy link
Owner

I added webkit-playsinline back when I was building this library for a specific use in a web app. I see now that it has matured a bit and webkit have unprefixed it, also that iOS10 will start allowing inline video playback in Safari, which is pretty cool. I think the right solution here would be to add playsinline as an actual prop (or part of fileConfig) and apply the attributes only if true.

In the meantime, you can already add playsinline by just doing:

<ReactPlayer fileConfig={{ attributes: { playsinline: true }}} />

@elverskog
Copy link

elverskog commented Feb 27, 2017

This didn't work for me using...

<ReactPlayer
fileConfig={{ attributes: { playsinline: true }}}
url={testVar.video}
ref={player => { this.player = player }}
...

As a test, if I go right into "lib/players/FilePlayer.js" and add this.player.setAttribute('playsinline', ''); it adds the tag and allows the inline playback (on iOS safari). Am I missing something? I made sure my version was up to date.

Update: If I add muted as an attribute that works. However neither show up when I inspect the element (in chrome).

@cookpete
Copy link
Owner

Sorry @elverskog, it turns out that playsinline isn't supported by react yet, so perhaps we just add playsinline as a top level ReactPlayer prop, and apply it to whatever players support it (looks like only fileplayer and youtube support it at the moment).

muted works because it is a supported react attribute.

david-hub024 pushed a commit to david-hub024/React_VideoPlayer that referenced this issue Dec 23, 2018
david-hub024 pushed a commit to david-hub024/React_VideoPlayer that referenced this issue May 23, 2020
albanqoku added a commit to albanqoku/react-player that referenced this issue Feb 24, 2021
Webmaster1116 added a commit to Webmaster1116/video-player that referenced this issue May 20, 2021
@ahcock
Copy link

ahcock commented Apr 18, 2022

it might be too late but
config={{ file: { attributes: { playsInline: true, }, }, }}

with camel case, it works well.

@SpaghettiCoder101
Copy link

it might be too late but config={{ file: { attributes: { playsInline: true, }, }, }}

with camel case, it works well.

You saved my life

webmiraclepro added a commit to webmiraclepro/video-player that referenced this issue Sep 9, 2022
@devjromero
Copy link

it might be too late but config={{ file: { attributes: { playsInline: true, }, }, }}

with camel case, it works well.

You saved my life x2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants