mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-12 23:36:15 -08:00
Add isBrowser check in Artplayer initialization
This commit is contained in:
1 parent
53b5c4165c
commit
29ff487547
7 files changed
+355
-20
No files matched your search
@@ -245,7 +245,9 @@ Artplayer.FULLSCREEN_WEB_IN_BODY = false;
|
||||
Artplayer.LOG_VERSION = true;
|
||||
Artplayer.USE_RAF = false;
|
||||
|
||||
if (typeof document !== 'undefined') {
|
||||
if (utils.isBrowser) {
|
||||
window['Artplayer'] = Artplayer;
|
||||
|
||||
const $style = document.getElementById('artplayer-style');
|
||||
if ($style) {
|
||||
$style.textContent = style;
|
||||
@@ -255,19 +257,15 @@ if (typeof document !== 'undefined') {
|
||||
$style.textContent = style;
|
||||
document.head.appendChild($style);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
window['Artplayer'] = Artplayer;
|
||||
setTimeout(() => {
|
||||
if (Artplayer.LOG_VERSION) {
|
||||
console.log(
|
||||
`%c ArtPlayer %c ${Artplayer.version} %c https://artplayer.org`,
|
||||
'color: #fff; background: #5f5f5f',
|
||||
'color: #fff; background: #4bc729',
|
||||
'',
|
||||
);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
if (Artplayer.LOG_VERSION) {
|
||||
console.log(
|
||||
`%c ArtPlayer %c ${Artplayer.version} %c https://artplayer.org`,
|
||||
'color: #fff; background: #5f5f5f',
|
||||
'color: #fff; background: #4bc729',
|
||||
'',
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -6,3 +6,4 @@ export const isAndroid = /android/i.test(userAgent);
|
||||
export const isIOS = /iPad|iPhone|iPod/i.test(userAgent) && !window.MSStream;
|
||||
export const isIOS13 = isIOS || (userAgent.includes('Macintosh') && navigator.maxTouchPoints >= 1);
|
||||
export const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent) || isIOS13;
|
||||
export const isBrowser = typeof window !== 'undefined';
|
||||
Reference in new issue
Block a user