diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-03-07 09:54:57 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-03-07 09:54:57 +0100 |
commit | 47bf592db786107f0cdc67b98f55c947acdb5a51 (patch) | |
tree | ef04324b78e235c8f210bbf96806ccaddb90608d /app/assets/javascripts/components/is_mobile.jsx | |
parent | 1fb3e8988b017155a9c23f19afa162b58e11590d (diff) |
Try to detect iOS and *not* autoplay any videos
Technically the check for iOS from components is a side effect, because it's neither in state nor props, but the user agent does not change, so I think that's okay.
Diffstat (limited to 'app/assets/javascripts/components/is_mobile.jsx')
-rw-r--r-- | app/assets/javascripts/components/is_mobile.jsx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/assets/javascripts/components/is_mobile.jsx b/app/assets/javascripts/components/is_mobile.jsx index eaa6221e4..992e63727 100644 --- a/app/assets/javascripts/components/is_mobile.jsx +++ b/app/assets/javascripts/components/is_mobile.jsx @@ -3,3 +3,9 @@ const LAYOUT_BREAKPOINT = 1024; export function isMobile(width) { return width <= LAYOUT_BREAKPOINT; }; + +const iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; + +export function isIOS() { + return iOS; +}; |