Modernizr: Playsinline detection

Created on 18 Sep 2016  Â·  6Comments  Â·  Source: Modernizr/Modernizr

Hi guys,

Do you have playsinline detection in the video element? I've looked through the docs but can't find it,

Most helpful comment

@patrickkettner While this works for iOS, it returns false on desktop browsers (tested on Chrome 55, MacOS Sierra), despite the fact that it obviously has no problem playing videos inline and does so by default. For this reason, I think the feature check needs a bit more nuance.

All 6 comments

Hey @chrisbell08!

we don't, but its straightforward to check yourself

'playsInline' in document.createElement('video')

only gotcha is its playsInline, not playsinline (note the capital I). I'll try to get one in Modernizr in the near future

Hey @patrickkettner ,

Thanks for the quick reply,

What i'm actually looking for is to detect if the browser supports "playsInline" not just if the attr exists on the element. If you use playInline on anything < iOS10 (Safari 10) it will still play fullscreen they've only implemented that in the latest version of safari

Hey Chris!
I know. That is how you detect it. This is called an IDL based detection.
When a browser adds a new parsable attribute to an element, they add it to
that elements IDL. You can easily check for these with a check like what I
sent before.

Try it in safari, and then in any other browser.

On Mon, Sep 19, 2016, 6:53 AM Chris Bell [email protected] wrote:

Hey @patrickkettner https://github.com/patrickkettner ,

Thanks for the quick reply,

What i'm actually looking for is to detect if the browser supports
"playsInline" not just if the attr exists on the element. If you use
playInline on anything < iOS10 (Safari 10) it will still play fullscreen
they've only implemented that in the latest version of safari

—
You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/Modernizr/Modernizr/issues/2077#issuecomment-247999175,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAcaBmmN15LH6QTj3N7KL2V1l5qpDsZAks5qrpPjgaJpZM4KAAL7
.

Ahh OK, never come across that before. Guess the beauty of modernizer is you don't normally have to look into these things it's all done for you. Thanks for your help :)

@patrickkettner While this works for iOS, it returns false on desktop browsers (tested on Chrome 55, MacOS Sierra), despite the fact that it obviously has no problem playing videos inline and does so by default. For this reason, I think the feature check needs a bit more nuance.

Hi @patrickkettner , I'm also trying to detect autoplay playsInline on devices, and I have the same issue than others with iOS10. I succeeded installing modernizr but may I ask you how to add 'playsInline' in document.createElement('video') ?
Thanks a lot !

Was this page helpful?
0 / 5 - 0 ratings