This commit is contained in:
Sam Potts
2018-08-01 00:56:44 +10:00
parent 13a54b5dbe
commit 2371619486
10 changed files with 253 additions and 869 deletions
+5 -15
View File
@@ -25,13 +25,9 @@ const support = {
// Check for support
// Basic functionality vs full UI
check(type, provider, playsinline) {
const canPlayInline =
browser.isIPhone && playsinline && support.playsinline;
const canPlayInline = browser.isIPhone && playsinline && support.playsinline;
const api = support[type] || provider !== 'html5';
const ui =
api &&
support.rangeInput &&
(type !== 'video' || !browser.isIPhone || canPlayInline);
const ui = api && support.rangeInput && (type !== 'video' || !browser.isIPhone || canPlayInline);
return {
api,
@@ -41,9 +37,7 @@ const support = {
// Picture-in-picture support
// Safari only currently
pip: (() =>
!browser.isIPhone &&
is.function(createElement('video').webkitSetPresentationMode))(),
pip: (() => !browser.isIPhone && is.function(createElement('video').webkitSetPresentationMode))(),
// Airplay support
// Safari only currently
@@ -75,9 +69,7 @@ const support = {
}
try {
return Boolean(
type && this.media.canPlayType(type).replace(/no/, ''),
);
return Boolean(type && this.media.canPlayType(type).replace(/no/, ''));
} catch (err) {
return false;
}
@@ -102,9 +94,7 @@ const support = {
// Reduced motion iOS & MacOS setting
// https://webkit.org/blog/7551/responsive-design-for-motion/
reducedMotion:
'matchMedia' in window &&
window.matchMedia('(prefers-reduced-motion)').matches,
reducedMotion: 'matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches,
};
export default support;