react-native-theoplayer 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/android/build.gradle +1 -1
- package/android/local/com/theoplayer/android-connector/mediasession/5.2.0-local/mediasession-5.2.0-local.aar +0 -0
- package/android/local/com/theoplayer/android-connector/mediasession/{4.12.0-local/mediasession-4.12.0-local.pom → 5.2.0-local/mediasession-5.2.0-local.pom} +1 -1
- package/android/local/com/theoplayer/android-connector/mediasession/maven-metadata-local.xml +4 -4
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/java/com/theoplayer/PlayerEventEmitter.kt +1 -1
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerContext.kt +36 -20
- package/android/src/main/java/com/theoplayer/media/CustomMediaButtonReceiver.kt +25 -0
- package/android/src/main/java/com/theoplayer/{audio → media}/MediaNotificationBuilder.kt +1 -1
- package/android/src/main/java/com/theoplayer/{audio → media}/MediaPlaybackService.kt +8 -3
- package/android/src/main/java/com/theoplayer/source/SourceAdapter.kt +12 -0
- package/android/src/main/java/com/theoplayer/track/TrackListAdapter.kt +17 -13
- package/lib/commonjs/api/source/dash/DashPlaybackConfiguration.js.map +1 -1
- package/lib/commonjs/api/track/TextTrack.js.map +1 -1
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js +17 -0
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/web/FullscreenAPI.js +41 -0
- package/lib/commonjs/internal/adapter/web/FullscreenAPI.js.map +1 -0
- package/lib/commonjs/internal/adapter/web/WebPresentationModeManager.js +45 -39
- package/lib/commonjs/internal/adapter/web/WebPresentationModeManager.js.map +1 -1
- package/lib/commonjs/internal/utils/CommonUtils.js +10 -0
- package/lib/commonjs/internal/utils/CommonUtils.js.map +1 -0
- package/lib/commonjs/ui/components/seekbar/thumbnail/Urlpolyfill.web.js +4 -11
- package/lib/commonjs/ui/components/seekbar/thumbnail/Urlpolyfill.web.js.map +1 -1
- package/lib/module/api/source/dash/DashPlaybackConfiguration.js.map +1 -1
- package/lib/module/api/track/TextTrack.js.map +1 -1
- package/lib/module/internal/adapter/THEOplayerAdapter.js +18 -1
- package/lib/module/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/module/internal/adapter/web/FullscreenAPI.js +34 -0
- package/lib/module/internal/adapter/web/FullscreenAPI.js.map +1 -0
- package/lib/module/internal/adapter/web/WebPresentationModeManager.js +45 -39
- package/lib/module/internal/adapter/web/WebPresentationModeManager.js.map +1 -1
- package/lib/module/internal/utils/CommonUtils.js +4 -0
- package/lib/module/internal/utils/CommonUtils.js.map +1 -0
- package/lib/module/ui/components/seekbar/thumbnail/Urlpolyfill.web.js +3 -2
- package/lib/module/ui/components/seekbar/thumbnail/Urlpolyfill.web.js.map +1 -1
- package/lib/typescript/api/source/dash/DashPlaybackConfiguration.d.ts +52 -0
- package/lib/typescript/api/track/TextTrack.d.ts +2 -2
- package/lib/typescript/internal/adapter/THEOplayerAdapter.d.ts +1 -0
- package/lib/typescript/internal/adapter/web/FullscreenAPI.d.ts +9 -0
- package/lib/typescript/internal/utils/CommonUtils.d.ts +1 -0
- package/lib/typescript/ui/components/seekbar/thumbnail/Urlpolyfill.web.d.ts +8 -1
- package/package.json +1 -1
- package/src/api/source/dash/DashPlaybackConfiguration.ts +56 -0
- package/src/api/track/TextTrack.ts +2 -2
- package/src/internal/adapter/THEOplayerAdapter.ts +19 -0
- package/src/internal/adapter/web/FullscreenAPI.ts +59 -0
- package/src/internal/adapter/web/WebPresentationModeManager.ts +29 -22
- package/src/internal/utils/CommonUtils.ts +3 -0
- package/src/ui/components/seekbar/thumbnail/Urlpolyfill.web.ts +3 -2
- package/android/local/com/theoplayer/android-connector/mediasession/4.12.0-local/mediasession-4.12.0-local.aar +0 -0
- package/lib/commonjs/web/platform/BrowserDetection.js +0 -34
- package/lib/commonjs/web/platform/BrowserDetection.js.map +0 -1
- package/lib/module/web/platform/BrowserDetection.js +0 -27
- package/lib/module/web/platform/BrowserDetection.js.map +0 -1
- package/lib/typescript/web/platform/BrowserDetection.d.ts +0 -23
- package/src/web/platform/BrowserDetection.ts +0 -38
|
@@ -16,21 +16,26 @@ import type {
|
|
|
16
16
|
RateChangeEvent,
|
|
17
17
|
SourceDescription,
|
|
18
18
|
TextTrack,
|
|
19
|
+
TextTrackEvent,
|
|
19
20
|
TextTrackListEvent,
|
|
20
21
|
THEOplayer,
|
|
21
22
|
THEOplayerView,
|
|
22
23
|
TimeUpdateEvent,
|
|
23
24
|
} from 'react-native-theoplayer';
|
|
24
25
|
import {
|
|
26
|
+
addTextTrackCue,
|
|
25
27
|
addTrack,
|
|
26
28
|
AspectRatio,
|
|
27
29
|
findMediaTrackByUid,
|
|
30
|
+
findTextTrackByUid,
|
|
28
31
|
MediaTrackEventType,
|
|
29
32
|
MediaTrackType,
|
|
30
33
|
PlayerEventType,
|
|
31
34
|
PreloadType,
|
|
32
35
|
PresentationMode,
|
|
36
|
+
removeTextTrackCue,
|
|
33
37
|
removeTrack,
|
|
38
|
+
TextTrackEventType,
|
|
34
39
|
TextTrackMode,
|
|
35
40
|
TextTrackStyle,
|
|
36
41
|
TrackListEventType,
|
|
@@ -97,6 +102,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
97
102
|
this.addEventListener(PlayerEventType.SEEKED, this.onSeeked);
|
|
98
103
|
this.addEventListener(PlayerEventType.PROGRESS, this.onProgress);
|
|
99
104
|
this.addEventListener(PlayerEventType.TEXT_TRACK_LIST, this.onTextTrackList);
|
|
105
|
+
this.addEventListener(PlayerEventType.TEXT_TRACK, this.onTextTrack);
|
|
100
106
|
this.addEventListener(PlayerEventType.MEDIA_TRACK, this.onMediaTrack);
|
|
101
107
|
this.addEventListener(PlayerEventType.MEDIA_TRACK_LIST, this.onMediaTrackList);
|
|
102
108
|
this.addEventListener(PlayerEventType.PRESENTATIONMODE_CHANGE, this.onPresentationModeChange);
|
|
@@ -157,6 +163,19 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
157
163
|
this._state.buffered = event.buffered?.sort((a, b) => a.end - b.end);
|
|
158
164
|
};
|
|
159
165
|
|
|
166
|
+
private onTextTrack = (event: TextTrackEvent) => {
|
|
167
|
+
const { subType, cue, trackUid } = event;
|
|
168
|
+
const track = findTextTrackByUid(this._state.textTracks, trackUid);
|
|
169
|
+
switch (subType) {
|
|
170
|
+
case TextTrackEventType.ADD_CUE:
|
|
171
|
+
addTextTrackCue(track, cue);
|
|
172
|
+
break;
|
|
173
|
+
case TextTrackEventType.REMOVE_CUE:
|
|
174
|
+
removeTextTrackCue(track, cue);
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
160
179
|
private onTextTrackList = (event: TextTrackListEvent) => {
|
|
161
180
|
const { subType, track } = event;
|
|
162
181
|
switch (subType) {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export interface FullscreenAPIMap {
|
|
2
|
+
requestFullscreen_: 'requestFullscreen';
|
|
3
|
+
exitFullscreen_: 'exitFullscreen';
|
|
4
|
+
fullscreenElement_: 'fullscreenElement';
|
|
5
|
+
fullscreenEnabled_: 'fullscreenEnabled';
|
|
6
|
+
fullscreenchange_: 'fullscreenchange';
|
|
7
|
+
fullscreenerror_: 'fullscreenerror';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const fullscreenAPI: FullscreenAPIMap | undefined = (() => {
|
|
11
|
+
if (!document) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// browser API methods
|
|
16
|
+
// map approach from Screenful.js - https://github.com/sindresorhus/screenfull.js
|
|
17
|
+
const apiMap: string[][] = [
|
|
18
|
+
// Spec: https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
|
|
19
|
+
['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'],
|
|
20
|
+
// WebKit
|
|
21
|
+
[
|
|
22
|
+
'webkitRequestFullscreen',
|
|
23
|
+
'webkitExitFullscreen',
|
|
24
|
+
'webkitFullscreenElement',
|
|
25
|
+
'webkitFullscreenEnabled',
|
|
26
|
+
'webkitfullscreenchange',
|
|
27
|
+
'webkitfullscreenerror'
|
|
28
|
+
],
|
|
29
|
+
// Old WebKit (Safari 5.1)
|
|
30
|
+
[
|
|
31
|
+
'webkitRequestFullScreen',
|
|
32
|
+
'webkitCancelFullScreen',
|
|
33
|
+
'webkitCurrentFullScreenElement',
|
|
34
|
+
'webkitCancelFullScreen',
|
|
35
|
+
'webkitfullscreenchange',
|
|
36
|
+
'webkitfullscreenerror'
|
|
37
|
+
],
|
|
38
|
+
// Mozilla
|
|
39
|
+
['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'],
|
|
40
|
+
// Microsoft
|
|
41
|
+
['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
for (const browserMap of apiMap) {
|
|
45
|
+
// check for exitFullscreen function
|
|
46
|
+
if (browserMap[1] in document) {
|
|
47
|
+
return {
|
|
48
|
+
requestFullscreen_: browserMap[0],
|
|
49
|
+
exitFullscreen_: browserMap[1],
|
|
50
|
+
fullscreenElement_: browserMap[2],
|
|
51
|
+
fullscreenEnabled_: browserMap[3],
|
|
52
|
+
fullscreenchange_: browserMap[4],
|
|
53
|
+
fullscreenerror_: browserMap[5]
|
|
54
|
+
} as FullscreenAPIMap;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return undefined;
|
|
59
|
+
})();
|
|
@@ -2,8 +2,9 @@ import type { PlayerEventMap } from 'react-native-theoplayer';
|
|
|
2
2
|
import { PresentationMode } from 'react-native-theoplayer';
|
|
3
3
|
import type * as THEOplayerWeb from 'theoplayer';
|
|
4
4
|
import { DefaultPresentationModeChangeEvent } from '../event/PlayerEvents';
|
|
5
|
-
import { browserDetection } from '../../../web/platform/BrowserDetection';
|
|
6
5
|
import type { DefaultEventDispatcher } from '../event/DefaultEventDispatcher';
|
|
6
|
+
import { fullscreenAPI } from './FullscreenAPI';
|
|
7
|
+
import { noOp } from '../../utils/CommonUtils';
|
|
7
8
|
|
|
8
9
|
export class WebPresentationModeManager {
|
|
9
10
|
private readonly _player: THEOplayerWeb.ChromelessPlayer;
|
|
@@ -27,31 +28,36 @@ export class WebPresentationModeManager {
|
|
|
27
28
|
|
|
28
29
|
this.prepareForPresentationModeChanges();
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
if (fullscreenAPI !== undefined) {
|
|
32
|
+
// All other browsers
|
|
32
33
|
if (presentationMode === PresentationMode.fullscreen) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
} else {
|
|
40
|
-
// other web-platformsyarn
|
|
41
|
-
|
|
42
|
-
if (presentationMode === PresentationMode.fullscreen) {
|
|
43
|
-
const appElement = document.getElementById('app');
|
|
44
|
-
void appElement?.requestFullscreen();
|
|
34
|
+
const appElement = document.getElementById('app')!;
|
|
35
|
+
const promise = appElement[fullscreenAPI.requestFullscreen_]();
|
|
36
|
+
if (promise && promise.then) {
|
|
37
|
+
promise.then(noOp, noOp);
|
|
38
|
+
}
|
|
45
39
|
} else if (presentationMode === PresentationMode.pip) {
|
|
46
40
|
void this._element?.requestPictureInPicture?.();
|
|
47
41
|
} else {
|
|
48
42
|
if (this._presentationMode === PresentationMode.fullscreen) {
|
|
49
|
-
|
|
43
|
+
const promise = document[fullscreenAPI.exitFullscreen_]();
|
|
44
|
+
if (promise && promise.then) {
|
|
45
|
+
promise.then(noOp, noOp);
|
|
46
|
+
}
|
|
50
47
|
}
|
|
51
48
|
if (this._presentationMode === PresentationMode.pip) {
|
|
52
49
|
void document.exitPictureInPicture();
|
|
53
50
|
}
|
|
54
51
|
}
|
|
52
|
+
} else {
|
|
53
|
+
// iOS Safari doesn't properly support fullscreen, use native fullscreen instead
|
|
54
|
+
if (presentationMode === PresentationMode.fullscreen) {
|
|
55
|
+
this._element?.webkitEnterFullscreen?.();
|
|
56
|
+
} else if (presentationMode === PresentationMode.pip) {
|
|
57
|
+
this._element?.webkitSetPresentationMode?.(PresentationMode.pip);
|
|
58
|
+
} else {
|
|
59
|
+
this._element?.webkitSetPresentationMode?.(PresentationMode.inline);
|
|
60
|
+
}
|
|
55
61
|
}
|
|
56
62
|
}
|
|
57
63
|
|
|
@@ -72,15 +78,16 @@ export class WebPresentationModeManager {
|
|
|
72
78
|
};
|
|
73
79
|
}
|
|
74
80
|
// listen for fullscreen updates on document
|
|
75
|
-
|
|
76
|
-
this.updatePresentationMode
|
|
77
|
-
|
|
81
|
+
if (fullscreenAPI !== undefined) {
|
|
82
|
+
document.addEventListener(fullscreenAPI.fullscreenchange_, this.updatePresentationMode);
|
|
83
|
+
document.addEventListener(fullscreenAPI.fullscreenerror_, this.updatePresentationMode);
|
|
84
|
+
}
|
|
78
85
|
}
|
|
79
86
|
|
|
80
|
-
private updatePresentationMode() {
|
|
87
|
+
private updatePresentationMode = () => {
|
|
81
88
|
// detect new presentation mode
|
|
82
89
|
let newPresentationMode: PresentationMode = PresentationMode.inline;
|
|
83
|
-
if (document.
|
|
90
|
+
if (fullscreenAPI !== undefined && document[fullscreenAPI.fullscreenElement_] !== null) {
|
|
84
91
|
newPresentationMode = PresentationMode.fullscreen;
|
|
85
92
|
} else if (document.pictureInPictureElement !== null) {
|
|
86
93
|
newPresentationMode = PresentationMode.pip;
|
|
@@ -92,5 +99,5 @@ export class WebPresentationModeManager {
|
|
|
92
99
|
this._presentationMode = newPresentationMode;
|
|
93
100
|
this._eventForwarder.dispatchEvent(new DefaultPresentationModeChangeEvent(this._presentationMode, previousPresentationMode));
|
|
94
101
|
}
|
|
95
|
-
}
|
|
102
|
+
};
|
|
96
103
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import 'url-polyfill';
|
|
2
|
+
const URL = global.URL;
|
|
3
|
+
export { URL };
|
|
Binary file
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.browserDetection = void 0;
|
|
7
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
9
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
|
-
const userAgent = navigator ? navigator.userAgent : '';
|
|
11
|
-
class BrowserDetection {
|
|
12
|
-
constructor() {
|
|
13
|
-
_defineProperty(this, "_isWindowsPhone", /windows phone (8|8\.1)/i.test(userAgent));
|
|
14
|
-
_defineProperty(this, "_isIphone", /iPhone/i.test(userAgent));
|
|
15
|
-
_defineProperty(this, "_isIpad", /iPad/i.test(userAgent));
|
|
16
|
-
_defineProperty(this, "_isIpod", /iPod/i.test(userAgent));
|
|
17
|
-
_defineProperty(this, "_isMac", /(mac\sos\sx)\s?([\w\s.]+\w)*/i.test(userAgent) || /(macintosh|mac(?=_powerpc)\s)/i.test(userAgent));
|
|
18
|
-
_defineProperty(this, "_isTizen", /SMART-TV.*Tizen/i.test(userAgent));
|
|
19
|
-
_defineProperty(this, "_isTouch", Boolean('ontouchstart' in self || self.DocumentTouch && document instanceof self.DocumentTouch || navigator && navigator.msMaxTouchPoints));
|
|
20
|
-
_defineProperty(this, "_isIpadOs", this._isMac && this._isTouch && !this._isIpad);
|
|
21
|
-
_defineProperty(this, "_isIos", (this._isIphone || this._isIpad || this._isIpadOs || this._isIpod) && !this._isWindowsPhone);
|
|
22
|
-
_defineProperty(this, "_isSafari", /Safari/i.test(userAgent) && !/Chrome/i.test(userAgent) && !this._isWindowsPhone && !this._isTizen);
|
|
23
|
-
}
|
|
24
|
-
get IS_IOS_() {
|
|
25
|
-
return this._isIos;
|
|
26
|
-
}
|
|
27
|
-
get IS_SAFARI_() {
|
|
28
|
-
return this._isSafari;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
_defineProperty(BrowserDetection, "instance_", new BrowserDetection());
|
|
32
|
-
const browserDetection = BrowserDetection.instance_;
|
|
33
|
-
exports.browserDetection = browserDetection;
|
|
34
|
-
//# sourceMappingURL=BrowserDetection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["userAgent","navigator","BrowserDetection","constructor","_defineProperty","test","Boolean","self","DocumentTouch","document","msMaxTouchPoints","_isMac","_isTouch","_isIpad","_isIphone","_isIpadOs","_isIpod","_isWindowsPhone","_isTizen","IS_IOS_","_isIos","IS_SAFARI_","_isSafari","browserDetection","instance_","exports"],"sources":["BrowserDetection.ts"],"sourcesContent":["declare global {\n interface Window {\n ActiveXObject?: any;\n DocumentTouch?: any;\n }\n}\nconst userAgent = navigator ? navigator.userAgent : '';\n\nclass BrowserDetection {\n static readonly instance_: BrowserDetection = new BrowserDetection();\n\n private readonly _isWindowsPhone: boolean = /windows phone (8|8\\.1)/i.test(userAgent);\n private readonly _isIphone: boolean = /iPhone/i.test(userAgent);\n private readonly _isIpad: boolean = /iPad/i.test(userAgent);\n private readonly _isIpod: boolean = /iPod/i.test(userAgent);\n private readonly _isMac: boolean = ( /(mac\\sos\\sx)\\s?([\\w\\s.]+\\w)*/i.test(userAgent)\n || /(macintosh|mac(?=_powerpc)\\s)/i.test(userAgent) );\n private readonly _isTizen: boolean = /SMART-TV.*Tizen/i.test(userAgent);\n private readonly _isTouch: boolean = Boolean(( 'ontouchstart' in self )\n || ( self.DocumentTouch && document instanceof self.DocumentTouch )\n || ( navigator && navigator.msMaxTouchPoints ));\n private readonly _isIpadOs: boolean = this._isMac && this._isTouch && !this._isIpad;\n private readonly _isIos: boolean = ( this._isIphone || this._isIpad || this._isIpadOs || this._isIpod )\n && !this._isWindowsPhone;\n private readonly _isSafari: boolean = /Safari/i.test(userAgent)\n && !( /Chrome/i.test(userAgent) ) && !this._isWindowsPhone && !this._isTizen;\n\n\n get IS_IOS_(): boolean {\n return this._isIos;\n }\n\n get IS_SAFARI_(): boolean {\n return this._isSafari;\n }\n}\n\nexport const browserDetection: BrowserDetection = BrowserDetection.instance_;\n"],"mappings":";;;;;;;;;AAMA,MAAMA,SAAS,GAAGC,SAAS,GAAGA,SAAS,CAACD,SAAS,GAAG,EAAE;AAEtD,MAAME,gBAAgB,CAAC;EAAAC,YAAA;IAAAC,eAAA,0BAGuB,yBAAyB,CAACC,IAAI,CAACL,SAAS,CAAC;IAAAI,eAAA,oBAC/C,SAAS,CAACC,IAAI,CAACL,SAAS,CAAC;IAAAI,eAAA,kBAC3B,OAAO,CAACC,IAAI,CAACL,SAAS,CAAC;IAAAI,eAAA,kBACvB,OAAO,CAACC,IAAI,CAACL,SAAS,CAAC;IAAAI,eAAA,iBACtB,+BAA+B,CAACC,IAAI,CAACL,SAAS,CAAC,IAC/E,gCAAgC,CAACK,IAAI,CAACL,SAAS,CAAC;IAAAI,eAAA,mBAChB,kBAAkB,CAACC,IAAI,CAACL,SAAS,CAAC;IAAAI,eAAA,mBAClCE,OAAO,CAAG,cAAc,IAAIC,IAAI,IAC9DA,IAAI,CAACC,aAAa,IAAIC,QAAQ,YAAYF,IAAI,CAACC,aAAe,IAC9DP,SAAS,IAAIA,SAAS,CAACS,gBAAkB,CAAC;IAAAN,eAAA,oBACX,IAAI,CAACO,MAAM,IAAI,IAAI,CAACC,QAAQ,IAAI,CAAC,IAAI,CAACC,OAAO;IAAAT,eAAA,iBAChD,CAAE,IAAI,CAACU,SAAS,IAAI,IAAI,CAACD,OAAO,IAAI,IAAI,CAACE,SAAS,IAAI,IAAI,CAACC,OAAO,KAChG,CAAC,IAAI,CAACC,eAAe;IAAAb,eAAA,oBACY,SAAS,CAACC,IAAI,CAACL,SAAS,CAAC,IAC1D,CAAG,SAAS,CAACK,IAAI,CAACL,SAAS,CAAG,IAAI,CAAC,IAAI,CAACiB,eAAe,IAAI,CAAC,IAAI,CAACC,QAAQ;EAAA;EAG9E,IAAIC,OAAOA,CAAA,EAAY;IACrB,OAAO,IAAI,CAACC,MAAM;EACpB;EAEA,IAAIC,UAAUA,CAAA,EAAY;IACxB,OAAO,IAAI,CAACC,SAAS;EACvB;AACF;AAAClB,eAAA,CA3BKF,gBAAgB,eAC0B,IAAIA,gBAAgB,EAAE;AA4B/D,MAAMqB,gBAAkC,GAAGrB,gBAAgB,CAACsB,SAAS;AAACC,OAAA,CAAAF,gBAAA,GAAAA,gBAAA"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
-
const userAgent = navigator ? navigator.userAgent : '';
|
|
5
|
-
class BrowserDetection {
|
|
6
|
-
constructor() {
|
|
7
|
-
_defineProperty(this, "_isWindowsPhone", /windows phone (8|8\.1)/i.test(userAgent));
|
|
8
|
-
_defineProperty(this, "_isIphone", /iPhone/i.test(userAgent));
|
|
9
|
-
_defineProperty(this, "_isIpad", /iPad/i.test(userAgent));
|
|
10
|
-
_defineProperty(this, "_isIpod", /iPod/i.test(userAgent));
|
|
11
|
-
_defineProperty(this, "_isMac", /(mac\sos\sx)\s?([\w\s.]+\w)*/i.test(userAgent) || /(macintosh|mac(?=_powerpc)\s)/i.test(userAgent));
|
|
12
|
-
_defineProperty(this, "_isTizen", /SMART-TV.*Tizen/i.test(userAgent));
|
|
13
|
-
_defineProperty(this, "_isTouch", Boolean('ontouchstart' in self || self.DocumentTouch && document instanceof self.DocumentTouch || navigator && navigator.msMaxTouchPoints));
|
|
14
|
-
_defineProperty(this, "_isIpadOs", this._isMac && this._isTouch && !this._isIpad);
|
|
15
|
-
_defineProperty(this, "_isIos", (this._isIphone || this._isIpad || this._isIpadOs || this._isIpod) && !this._isWindowsPhone);
|
|
16
|
-
_defineProperty(this, "_isSafari", /Safari/i.test(userAgent) && !/Chrome/i.test(userAgent) && !this._isWindowsPhone && !this._isTizen);
|
|
17
|
-
}
|
|
18
|
-
get IS_IOS_() {
|
|
19
|
-
return this._isIos;
|
|
20
|
-
}
|
|
21
|
-
get IS_SAFARI_() {
|
|
22
|
-
return this._isSafari;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
_defineProperty(BrowserDetection, "instance_", new BrowserDetection());
|
|
26
|
-
export const browserDetection = BrowserDetection.instance_;
|
|
27
|
-
//# sourceMappingURL=BrowserDetection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["userAgent","navigator","BrowserDetection","constructor","_defineProperty","test","Boolean","self","DocumentTouch","document","msMaxTouchPoints","_isMac","_isTouch","_isIpad","_isIphone","_isIpadOs","_isIpod","_isWindowsPhone","_isTizen","IS_IOS_","_isIos","IS_SAFARI_","_isSafari","browserDetection","instance_"],"sources":["BrowserDetection.ts"],"sourcesContent":["declare global {\n interface Window {\n ActiveXObject?: any;\n DocumentTouch?: any;\n }\n}\nconst userAgent = navigator ? navigator.userAgent : '';\n\nclass BrowserDetection {\n static readonly instance_: BrowserDetection = new BrowserDetection();\n\n private readonly _isWindowsPhone: boolean = /windows phone (8|8\\.1)/i.test(userAgent);\n private readonly _isIphone: boolean = /iPhone/i.test(userAgent);\n private readonly _isIpad: boolean = /iPad/i.test(userAgent);\n private readonly _isIpod: boolean = /iPod/i.test(userAgent);\n private readonly _isMac: boolean = ( /(mac\\sos\\sx)\\s?([\\w\\s.]+\\w)*/i.test(userAgent)\n || /(macintosh|mac(?=_powerpc)\\s)/i.test(userAgent) );\n private readonly _isTizen: boolean = /SMART-TV.*Tizen/i.test(userAgent);\n private readonly _isTouch: boolean = Boolean(( 'ontouchstart' in self )\n || ( self.DocumentTouch && document instanceof self.DocumentTouch )\n || ( navigator && navigator.msMaxTouchPoints ));\n private readonly _isIpadOs: boolean = this._isMac && this._isTouch && !this._isIpad;\n private readonly _isIos: boolean = ( this._isIphone || this._isIpad || this._isIpadOs || this._isIpod )\n && !this._isWindowsPhone;\n private readonly _isSafari: boolean = /Safari/i.test(userAgent)\n && !( /Chrome/i.test(userAgent) ) && !this._isWindowsPhone && !this._isTizen;\n\n\n get IS_IOS_(): boolean {\n return this._isIos;\n }\n\n get IS_SAFARI_(): boolean {\n return this._isSafari;\n }\n}\n\nexport const browserDetection: BrowserDetection = BrowserDetection.instance_;\n"],"mappings":";;;AAMA,MAAMA,SAAS,GAAGC,SAAS,GAAGA,SAAS,CAACD,SAAS,GAAG,EAAE;AAEtD,MAAME,gBAAgB,CAAC;EAAAC,YAAA;IAAAC,eAAA,0BAGuB,yBAAyB,CAACC,IAAI,CAACL,SAAS,CAAC;IAAAI,eAAA,oBAC/C,SAAS,CAACC,IAAI,CAACL,SAAS,CAAC;IAAAI,eAAA,kBAC3B,OAAO,CAACC,IAAI,CAACL,SAAS,CAAC;IAAAI,eAAA,kBACvB,OAAO,CAACC,IAAI,CAACL,SAAS,CAAC;IAAAI,eAAA,iBACtB,+BAA+B,CAACC,IAAI,CAACL,SAAS,CAAC,IAC/E,gCAAgC,CAACK,IAAI,CAACL,SAAS,CAAC;IAAAI,eAAA,mBAChB,kBAAkB,CAACC,IAAI,CAACL,SAAS,CAAC;IAAAI,eAAA,mBAClCE,OAAO,CAAG,cAAc,IAAIC,IAAI,IAC9DA,IAAI,CAACC,aAAa,IAAIC,QAAQ,YAAYF,IAAI,CAACC,aAAe,IAC9DP,SAAS,IAAIA,SAAS,CAACS,gBAAkB,CAAC;IAAAN,eAAA,oBACX,IAAI,CAACO,MAAM,IAAI,IAAI,CAACC,QAAQ,IAAI,CAAC,IAAI,CAACC,OAAO;IAAAT,eAAA,iBAChD,CAAE,IAAI,CAACU,SAAS,IAAI,IAAI,CAACD,OAAO,IAAI,IAAI,CAACE,SAAS,IAAI,IAAI,CAACC,OAAO,KAChG,CAAC,IAAI,CAACC,eAAe;IAAAb,eAAA,oBACY,SAAS,CAACC,IAAI,CAACL,SAAS,CAAC,IAC1D,CAAG,SAAS,CAACK,IAAI,CAACL,SAAS,CAAG,IAAI,CAAC,IAAI,CAACiB,eAAe,IAAI,CAAC,IAAI,CAACC,QAAQ;EAAA;EAG9E,IAAIC,OAAOA,CAAA,EAAY;IACrB,OAAO,IAAI,CAACC,MAAM;EACpB;EAEA,IAAIC,UAAUA,CAAA,EAAY;IACxB,OAAO,IAAI,CAACC,SAAS;EACvB;AACF;AAAClB,eAAA,CA3BKF,gBAAgB,eAC0B,IAAIA,gBAAgB,EAAE;AA4BtE,OAAO,MAAMqB,gBAAkC,GAAGrB,gBAAgB,CAACsB,SAAS"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
interface Window {
|
|
3
|
-
ActiveXObject?: any;
|
|
4
|
-
DocumentTouch?: any;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
declare class BrowserDetection {
|
|
8
|
-
static readonly instance_: BrowserDetection;
|
|
9
|
-
private readonly _isWindowsPhone;
|
|
10
|
-
private readonly _isIphone;
|
|
11
|
-
private readonly _isIpad;
|
|
12
|
-
private readonly _isIpod;
|
|
13
|
-
private readonly _isMac;
|
|
14
|
-
private readonly _isTizen;
|
|
15
|
-
private readonly _isTouch;
|
|
16
|
-
private readonly _isIpadOs;
|
|
17
|
-
private readonly _isIos;
|
|
18
|
-
private readonly _isSafari;
|
|
19
|
-
get IS_IOS_(): boolean;
|
|
20
|
-
get IS_SAFARI_(): boolean;
|
|
21
|
-
}
|
|
22
|
-
export declare const browserDetection: BrowserDetection;
|
|
23
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
interface Window {
|
|
3
|
-
ActiveXObject?: any;
|
|
4
|
-
DocumentTouch?: any;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
const userAgent = navigator ? navigator.userAgent : '';
|
|
8
|
-
|
|
9
|
-
class BrowserDetection {
|
|
10
|
-
static readonly instance_: BrowserDetection = new BrowserDetection();
|
|
11
|
-
|
|
12
|
-
private readonly _isWindowsPhone: boolean = /windows phone (8|8\.1)/i.test(userAgent);
|
|
13
|
-
private readonly _isIphone: boolean = /iPhone/i.test(userAgent);
|
|
14
|
-
private readonly _isIpad: boolean = /iPad/i.test(userAgent);
|
|
15
|
-
private readonly _isIpod: boolean = /iPod/i.test(userAgent);
|
|
16
|
-
private readonly _isMac: boolean = ( /(mac\sos\sx)\s?([\w\s.]+\w)*/i.test(userAgent)
|
|
17
|
-
|| /(macintosh|mac(?=_powerpc)\s)/i.test(userAgent) );
|
|
18
|
-
private readonly _isTizen: boolean = /SMART-TV.*Tizen/i.test(userAgent);
|
|
19
|
-
private readonly _isTouch: boolean = Boolean(( 'ontouchstart' in self )
|
|
20
|
-
|| ( self.DocumentTouch && document instanceof self.DocumentTouch )
|
|
21
|
-
|| ( navigator && navigator.msMaxTouchPoints ));
|
|
22
|
-
private readonly _isIpadOs: boolean = this._isMac && this._isTouch && !this._isIpad;
|
|
23
|
-
private readonly _isIos: boolean = ( this._isIphone || this._isIpad || this._isIpadOs || this._isIpod )
|
|
24
|
-
&& !this._isWindowsPhone;
|
|
25
|
-
private readonly _isSafari: boolean = /Safari/i.test(userAgent)
|
|
26
|
-
&& !( /Chrome/i.test(userAgent) ) && !this._isWindowsPhone && !this._isTizen;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
get IS_IOS_(): boolean {
|
|
30
|
-
return this._isIos;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
get IS_SAFARI_(): boolean {
|
|
34
|
-
return this._isSafari;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const browserDetection: BrowserDetection = BrowserDetection.instance_;
|