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

Remove autoplay value, fixing compatibility with Safari macOS and iOS 11 #112

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

thegreatsunra
Copy link

Autoplay is a boolean attribute, and Safari (both macOS and iOS 11 Safari) appears to choke if it is given a value.

The spec states, counter-intuitively, that passing an empty string as the value is the proper way to to define a boolean attribute as true:

Boolean attributes are considered to be true if they're present on the element at all, regardless of their actual value; as a rule, you should specify the empty string (””) in value (some people use the attribute's name; this works but is non-standard).

Autoplay is a boolean attribute, and Safari (both macOS and iOS 11
Safari) appears to choke if it is given a value.

[The spec
states](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttr
ibute#Example), counter-intuitively, that passing an _empty string_ as
the `value` is the proper way to to define a boolean attribute as
`true`:

> Boolean attributes are considered to be true if they're present on
the element at all, regardless of their actual value; as a rule, you
should specify the empty string (`””`) in `value` (some people use the
attribute's name; this works but is non-standard).
Upon further testing it appears Safari iOS continues to choke even with an empty attribute.

Considering the attribute should be applied to the HTML element itself, there shouldn't be a need to add it programmatically.
@thegreatsunra
Copy link
Author

Upon further testing it appears iOS 11 Safari continues to choke on the blank attribute, so I have removed it entirely.

@aaerofeev
Copy link

aaerofeev commented Dec 12, 2017

Hello! When your pull request will be in release? I want using component in IOS 11!

@EGreg
Copy link

EGreg commented Jan 9, 2018

Have you teste it and it works?

@jonpemby
Copy link

It's working for me on iOS 11 Safari.

@nhoizey
Copy link

nhoizey commented Feb 23, 2018

Any progress on this? Thanks!

@avmaisak
Copy link

Hello, @thegreatsunra

Could you propose this PR to my fork, please?
https://github.com/avmaisak/instascan

@prayerslayer
Copy link

Btw if your video isn't playing on iOS after user consent regarding webcam access, check if you gave Instascan a playsinline (playsInline in react) attribute. That's required in addition to autoplay. https://stackoverflow.com/questions/43570460/html5-video-autoplay-on-iphone

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

Successfully merging this pull request may close these issues.

7 participants