xgplayer 2.32.5 → 2.32.6
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/browser/controls/airplay.js +1 -1
- package/browser/controls/cssFullscreen.js +1 -1
- package/browser/controls/danmu.js +3 -1
- package/browser/controls/definition.js +1 -1
- package/browser/controls/download.js +1 -1
- package/browser/controls/enter.js +1 -1
- package/browser/controls/error.js +1 -1
- package/browser/controls/errorRetry.js +1 -1
- package/browser/controls/flex.js +1 -1
- package/browser/controls/fullscreen.js +1 -1
- package/browser/controls/loading.js +1 -1
- package/browser/controls/memoryPlay.js +1 -1
- package/browser/controls/miniplayer.js +9 -7
- package/browser/controls/mobile.js +1 -1
- package/browser/controls/nativeTextTrack.js +1 -1
- package/browser/controls/pc.js +1 -1
- package/browser/controls/pip.js +1 -1
- package/browser/controls/play.js +1 -1
- package/browser/controls/playNext.js +1 -1
- package/browser/controls/playbackRate.js +1 -1
- package/browser/controls/poster.js +1 -1
- package/browser/controls/progress.js +1 -1
- package/browser/controls/reload.js +1 -1
- package/browser/controls/replay.js +1 -1
- package/browser/controls/rotate.js +1 -1
- package/browser/controls/screenShot.js +1 -1
- package/browser/controls/start.js +1 -1
- package/browser/controls/textTrack.js +1 -1
- package/browser/controls/time.js +1 -1
- package/browser/controls/volume.js +1 -1
- package/browser/core_player.js +1 -1
- package/browser/core_player.js.map +1 -1
- package/browser/index.js +11 -7
- package/browser/index.js.map +1 -1
- package/browser/simple_player.js +1 -1
- package/browser/simple_player.js.map +1 -1
- package/dist/controls/airplay.js +1 -1
- package/dist/controls/cssFullscreen.js +1 -1
- package/dist/controls/danmu.js +3 -1
- package/dist/controls/definition.js +1 -1
- package/dist/controls/download.js +1 -1
- package/dist/controls/enter.js +1 -1
- package/dist/controls/error.js +1 -1
- package/dist/controls/errorRetry.js +1 -1
- package/dist/controls/flex.js +1 -1
- package/dist/controls/fullscreen.js +1 -1
- package/dist/controls/loading.js +1 -1
- package/dist/controls/memoryPlay.js +1 -1
- package/dist/controls/miniplayer.js +9 -7
- package/dist/controls/mobile.js +1 -1
- package/dist/controls/nativeTextTrack.js +1 -1
- package/dist/controls/pc.js +1 -1
- package/dist/controls/pip.js +1 -1
- package/dist/controls/play.js +1 -1
- package/dist/controls/playNext.js +1 -1
- package/dist/controls/playbackRate.js +1 -1
- package/dist/controls/poster.js +1 -1
- package/dist/controls/progress.js +1 -1
- package/dist/controls/reload.js +1 -1
- package/dist/controls/replay.js +1 -1
- package/dist/controls/rotate.js +1 -1
- package/dist/controls/screenShot.js +1 -1
- package/dist/controls/start.js +1 -1
- package/dist/controls/textTrack.js +1 -1
- package/dist/controls/time.js +1 -1
- package/dist/controls/volume.js +1 -1
- package/dist/core_player.js +2960 -2889
- package/dist/core_player.js.map +1 -1
- package/dist/index.js +1938 -3321
- package/dist/index.js.map +1 -1
- package/dist/index.min.css +1 -0
- package/dist/index.min.js +2 -0
- package/dist/index.min.js.map +1 -0
- package/dist/simple_player.js +274 -281
- package/dist/simple_player.js.map +1 -1
- package/es/_virtual/_rollupPluginBabelHelpers.js +216 -0
- package/es/constant.d.ts +4 -0
- package/es/constant.js +5 -0
- package/es/controls/airplay.js +1 -1
- package/es/controls/cssFullscreen.js +1 -1
- package/es/controls/danmu.js +3 -1
- package/es/controls/definition.js +1 -1
- package/es/controls/download.js +1 -1
- package/es/controls/enter.js +1 -1
- package/es/controls/error.js +1 -1
- package/es/controls/errorRetry.js +1 -1
- package/es/controls/flex.js +1 -1
- package/es/controls/fullscreen.js +1 -1
- package/es/controls/i18n.js +1 -1
- package/es/controls/keyboard.js +1 -1
- package/es/controls/loading.js +1 -1
- package/es/controls/localPreview.js +1 -1
- package/es/controls/memoryPlay.js +1 -1
- package/es/controls/miniplayer.js +9 -7
- package/es/controls/mobile.js +1 -1
- package/es/controls/nativeTextTrack.js +1 -1
- package/es/controls/pc.js +1 -1
- package/es/controls/pip.js +1 -1
- package/es/controls/play.js +1 -1
- package/es/controls/playNext.js +1 -1
- package/es/controls/playbackRate.js +1 -1
- package/es/controls/poster.js +1 -1
- package/es/controls/progress.js +1 -1
- package/es/controls/reload.js +1 -1
- package/es/controls/replay.js +1 -1
- package/es/controls/rotate.js +1 -1
- package/es/controls/screenShot.js +1 -1
- package/es/controls/start.js +1 -1
- package/es/controls/textTrack.js +1 -1
- package/es/controls/time.js +1 -1
- package/es/controls/volume.js +1 -1
- package/es/core_player.js +1 -1
- package/es/core_player.js.map +1 -1
- package/es/defaultConfig.d.ts +243 -0
- package/es/defaultConfig.js +85 -0
- package/es/error.d.ts +114 -0
- package/es/error.js +75 -0
- package/es/events.d.ts +61 -0
- package/es/events.js +62 -0
- package/es/icons.d.ts +2 -0
- package/es/index.css +499 -0
- package/es/index.d.ts +25 -0
- package/es/index.js +11 -7
- package/es/index.js.map +1 -1
- package/es/index.scss +29 -0
- package/es/index.umd.d.ts +60 -0
- package/es/index.umd.js +30 -0
- package/es/lang/en.d.ts +91 -0
- package/es/lang/en.js +77 -0
- package/es/lang/i18n.d.ts +36 -0
- package/es/lang/i18n.js +122 -0
- package/es/lang/index.d.ts +2 -0
- package/es/lang/jp.d.ts +91 -0
- package/es/lang/jp.js +77 -0
- package/es/lang/zh-cn.d.ts +91 -0
- package/es/lang/zh-cn.js +77 -0
- package/es/lang/zh-hk.d.ts +91 -0
- package/es/lang/zh-hk.js +77 -0
- package/es/mediaProxy.d.ts +334 -0
- package/es/mediaProxy.js +623 -0
- package/es/player.d.ts +825 -0
- package/es/player.js +1945 -0
- package/es/plugin/basePlugin.d.ts +180 -0
- package/es/plugin/basePlugin.js +259 -0
- package/es/plugin/hooksDescriptor.d.ts +60 -0
- package/es/plugin/hooksDescriptor.js +149 -0
- package/es/plugin/index.d.ts +13 -0
- package/es/plugin/plugin.d.ts +207 -0
- package/es/plugin/plugin.js +542 -0
- package/es/plugin/pluginsManager.d.ts +162 -0
- package/es/plugin/pluginsManager.js +362 -0
- package/es/plugin/preset.d.ts +1 -0
- package/es/plugin/preset.js +28 -0
- package/es/plugin/resizeObserver.d.ts +3 -0
- package/es/plugin/resizeObserver.js +108 -0
- package/es/plugins/assets/back.js +4 -0
- package/es/plugins/assets/download.js +4 -0
- package/es/plugins/assets/exitCssFull.js +4 -0
- package/es/plugins/assets/exitFull.js +4 -0
- package/es/plugins/assets/loading.js +4 -0
- package/es/plugins/assets/panel.js +4 -0
- package/es/plugins/assets/pause.js +4 -0
- package/es/plugins/assets/pipIcon.js +4 -0
- package/es/plugins/assets/pipIconExit.js +4 -0
- package/es/plugins/assets/play.js +4 -0
- package/es/plugins/assets/playNext.js +4 -0
- package/es/plugins/assets/replay.js +4 -0
- package/es/plugins/assets/requestCssFull.js +7 -0
- package/es/plugins/assets/requestFull.js +4 -0
- package/es/plugins/assets/rotate.js +4 -0
- package/es/plugins/assets/seekicon.js +4 -0
- package/es/plugins/assets/volumeLarge.js +4 -0
- package/es/plugins/assets/volumeMuted.js +4 -0
- package/es/plugins/assets/volumeSmall.js +4 -0
- package/es/plugins/common/iconPlugin.d.ts +5 -0
- package/es/plugins/common/iconPlugin.js +42 -0
- package/es/plugins/common/iconTools.d.ts +1 -0
- package/es/plugins/common/iconTools.js +8 -0
- package/es/plugins/common/index.scss +2 -0
- package/es/plugins/common/optionList.d.ts +15 -0
- package/es/plugins/common/optionList.js +120 -0
- package/es/plugins/common/optionsIcon.d.ts +40 -0
- package/es/plugins/common/optionsIcon.js +304 -0
- package/es/plugins/common/optionsIcon.scss +154 -0
- package/es/plugins/common/thumbnail.d.ts +62 -0
- package/es/plugins/common/thumbnail.js +191 -0
- package/es/plugins/common/thumbnail.scss +27 -0
- package/es/plugins/controls/index.css +132 -0
- package/es/plugins/controls/index.d.ts +73 -0
- package/es/plugins/controls/index.js +189 -0
- package/es/plugins/controls/index.scss +204 -0
- package/es/plugins/cssFullScreen/index.css +12 -0
- package/es/plugins/cssFullScreen/index.d.ts +40 -0
- package/es/plugins/cssFullScreen/index.js +136 -0
- package/es/plugins/cssFullScreen/index.scss +19 -0
- package/es/plugins/danmu/danmuIcon.d.ts +24 -0
- package/es/plugins/danmu/danmuIcon.js +98 -0
- package/es/plugins/danmu/danmuPanel.d.ts +39 -0
- package/es/plugins/danmu/danmuPanel.js +81 -0
- package/es/plugins/danmu/index.css +603 -0
- package/es/plugins/danmu/index.d.ts +96 -0
- package/es/plugins/danmu/index.js +313 -0
- package/es/plugins/danmu/index.scss +356 -0
- package/es/plugins/definition/index.css +4 -0
- package/es/plugins/definition/index.d.ts +38 -0
- package/es/plugins/definition/index.js +164 -0
- package/es/plugins/definition/index.scss +4 -0
- package/es/plugins/download/index.css +13 -0
- package/es/plugins/download/index.d.ts +31 -0
- package/es/plugins/download/index.js +107 -0
- package/es/plugins/download/index.scss +22 -0
- package/es/plugins/dynamicBg/index.css +16 -0
- package/es/plugins/dynamicBg/index.d.ts +83 -0
- package/es/plugins/dynamicBg/index.js +316 -0
- package/es/plugins/dynamicBg/index.scss +19 -0
- package/es/plugins/enter/index.css +104 -0
- package/es/plugins/enter/index.d.ts +19 -0
- package/es/plugins/enter/index.js +46 -0
- package/es/plugins/enter/index.scss +78 -0
- package/es/plugins/error/index.css +29 -0
- package/es/plugins/error/index.d.ts +8 -0
- package/es/plugins/error/index.js +75 -0
- package/es/plugins/error/index.scss +34 -0
- package/es/plugins/fpsDetect/index.d.ts +34 -0
- package/es/plugins/fpsDetect/index.js +149 -0
- package/es/plugins/fullscreen/backicon.d.ts +17 -0
- package/es/plugins/fullscreen/backicon.js +72 -0
- package/es/plugins/fullscreen/index.css +23 -0
- package/es/plugins/fullscreen/index.d.ts +58 -0
- package/es/plugins/fullscreen/index.js +202 -0
- package/es/plugins/fullscreen/index.scss +35 -0
- package/es/plugins/gapJump/index.d.ts +21 -0
- package/es/plugins/gapJump/index.js +142 -0
- package/es/plugins/keyboard/index.d.ts +89 -0
- package/es/plugins/keyboard/index.js +421 -0
- package/es/plugins/loading/index.css +58 -0
- package/es/plugins/loading/index.d.ts +11 -0
- package/es/plugins/loading/index.js +43 -0
- package/es/plugins/loading/index.scss +70 -0
- package/es/plugins/logger/index.d.ts +54 -0
- package/es/plugins/logger/index.js +311 -0
- package/es/plugins/miniScreen/index.css +179 -0
- package/es/plugins/miniScreen/index.d.ts +68 -0
- package/es/plugins/miniScreen/index.js +212 -0
- package/es/plugins/miniScreen/index.scss +198 -0
- package/es/plugins/miniScreen/miniScreenIcon.d.ts +11 -0
- package/es/plugins/miniScreen/miniScreenIcon.js +56 -0
- package/es/plugins/mobile/index.css +181 -0
- package/es/plugins/mobile/index.d.ts +125 -0
- package/es/plugins/mobile/index.js +631 -0
- package/es/plugins/mobile/index.scss +180 -0
- package/es/plugins/mobile/touch.d.ts +43 -0
- package/es/plugins/mobile/touch.js +214 -0
- package/es/plugins/netAdaption/index.d.ts +5 -0
- package/es/plugins/pc/index.css +3 -0
- package/es/plugins/pc/index.d.ts +14 -0
- package/es/plugins/pc/index.js +199 -0
- package/es/plugins/pc/index.scss +5 -0
- package/es/plugins/pip/index.css +12 -0
- package/es/plugins/pip/index.d.ts +37 -0
- package/es/plugins/pip/index.js +222 -0
- package/es/plugins/pip/index.scss +21 -0
- package/es/plugins/play/index.css +12 -0
- package/es/plugins/play/index.d.ts +23 -0
- package/es/plugins/play/index.js +127 -0
- package/es/plugins/play/index.scss +18 -0
- package/es/plugins/playNext/index.css +22 -0
- package/es/plugins/playNext/index.d.ts +19 -0
- package/es/plugins/playNext/index.js +104 -0
- package/es/plugins/playNext/index.scss +35 -0
- package/es/plugins/playbackRate/index.css +4 -0
- package/es/plugins/playbackRate/index.d.ts +31 -0
- package/es/plugins/playbackRate/index.js +140 -0
- package/es/plugins/playbackRate/index.scss +6 -0
- package/es/plugins/poster/index.css +39 -0
- package/es/plugins/poster/index.d.ts +27 -0
- package/es/plugins/poster/index.js +109 -0
- package/es/plugins/poster/index.scss +56 -0
- package/es/plugins/progress/index.css +234 -0
- package/es/plugins/progress/index.d.ts +178 -0
- package/es/plugins/progress/index.js +687 -0
- package/es/plugins/progress/index.scss +288 -0
- package/es/plugins/progress/innerList.d.ts +49 -0
- package/es/plugins/progress/innerList.js +285 -0
- package/es/plugins/progress/miniProgress.d.ts +9 -0
- package/es/plugins/progress/miniProgress.js +55 -0
- package/es/plugins/progressPreview/dotsApi.d.ts +1 -0
- package/es/plugins/progressPreview/dotsApi.js +269 -0
- package/es/plugins/progressPreview/index.css +190 -0
- package/es/plugins/progressPreview/index.d.ts +87 -0
- package/es/plugins/progressPreview/index.js +475 -0
- package/es/plugins/progressPreview/index.scss +235 -0
- package/es/plugins/prompt/index.css +47 -0
- package/es/plugins/prompt/index.d.ts +24 -0
- package/es/plugins/prompt/index.js +110 -0
- package/es/plugins/prompt/index.scss +53 -0
- package/es/plugins/replay/index.css +33 -0
- package/es/plugins/replay/index.d.ts +16 -0
- package/es/plugins/replay/index.js +109 -0
- package/es/plugins/replay/index.scss +41 -0
- package/es/plugins/rotate/index.css +0 -0
- package/es/plugins/rotate/index.d.ts +22 -0
- package/es/plugins/rotate/index.js +148 -0
- package/es/plugins/rotate/index.scss +0 -0
- package/es/plugins/rotate/index2.js +2 -0
- package/es/plugins/screenShot/index.css +3 -0
- package/es/plugins/screenShot/index.d.ts +30 -0
- package/es/plugins/screenShot/index.js +178 -0
- package/es/plugins/screenShot/index.scss +5 -0
- package/es/plugins/start/index.css +91 -0
- package/es/plugins/start/index.d.ts +41 -0
- package/es/plugins/start/index.js +267 -0
- package/es/plugins/start/index.scss +115 -0
- package/es/plugins/stats/index.d.ts +38 -0
- package/es/plugins/stats/index.js +194 -0
- package/es/plugins/testspeed/index.d.ts +26 -0
- package/es/plugins/testspeed/index.js +207 -0
- package/es/plugins/time/index.css +46 -0
- package/es/plugins/time/index.d.ts +28 -0
- package/es/plugins/time/index.js +225 -0
- package/es/plugins/time/index.scss +57 -0
- package/es/plugins/time/timesegments.d.ts +24 -0
- package/es/plugins/time/timesegments.js +216 -0
- package/es/plugins/track/index.css +91 -0
- package/es/plugins/track/index.d.ts +132 -0
- package/es/plugins/track/index.js +463 -0
- package/es/plugins/track/index.scss +111 -0
- package/es/plugins/track/nativeSubTitle.d.ts +22 -0
- package/es/plugins/track/nativeSubTitle.js +94 -0
- package/es/plugins/volume/index.css +95 -0
- package/es/plugins/volume/index.d.ts +88 -0
- package/es/plugins/volume/index.js +319 -0
- package/es/plugins/volume/index.scss +124 -0
- package/es/plugins/waitingTimeoutJump/index.d.ts +15 -0
- package/es/plugins/waitingTimeoutJump/index.js +88 -0
- package/es/presets/default-en.d.ts +33 -0
- package/es/presets/default-en.js +63 -0
- package/es/presets/default.d.ts +34 -0
- package/es/presets/default.js +70 -0
- package/es/presets/index.d.ts +4 -0
- package/es/presets/live.d.ts +94 -0
- package/es/presets/live.js +39 -0
- package/es/presets/mobile.d.ts +103 -0
- package/es/presets/mobile.js +34 -0
- package/es/simple_player.js +1 -1
- package/es/simple_player.js.map +1 -1
- package/es/state.d.ts +11 -0
- package/es/state.js +12 -0
- package/es/stateClassMap.d.ts +32 -0
- package/es/stateClassMap.js +32 -0
- package/es/style/common/animation.scss +16 -0
- package/es/style/common/svg-url.scss +70 -0
- package/es/style/common.scss +457 -0
- package/es/style/index.scss +4 -0
- package/es/style/variable.scss +76 -0
- package/es/utils/database.d.ts +31 -0
- package/es/utils/database.js +107 -0
- package/es/utils/debug.d.ts +10 -0
- package/es/utils/debug.js +43 -0
- package/es/utils/draggabilly.d.ts +54 -0
- package/es/utils/draggabilly.js +410 -0
- package/es/utils/sniffer.d.ts +28 -0
- package/es/utils/sniffer.js +150 -0
- package/es/utils/url.d.ts +1 -0
- package/es/utils/util.d.ts +304 -0
- package/es/utils/util.js +827 -0
- package/es/utils/xgplayerTimeRange.d.ts +7 -0
- package/es/utils/xgplayerTimeRange.js +25 -0
- package/es/version.d.ts +2 -0
- package/es/version.js +2 -0
- package/package.json +2 -3
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
var VERSION_REG = {
|
|
2
|
+
android: /(Android)\s([\d.]+)/,
|
|
3
|
+
ios: /(Version)\/([\d.]+)/
|
|
4
|
+
};
|
|
5
|
+
var H264_MIMETYPES = ["avc1.42E01E, mp4a.40.2", "avc1.58A01E, mp4a.40.2", "avc1.4D401E, mp4a.40.2", "avc1.64001E, mp4a.40.2", "avc1.42E01E", "mp4v.20.8", "avc1.42E01E, mp4a.40.2", "avc1.58A01E, mp4a.40.2", "avc1.4D401E, mp4a.40.2", "avc1.64001E, mp4a.40.2", "mp4v.20.8, mp4a.40.2", "mp4v.20.240, mp4a.40.2"];
|
|
6
|
+
var sniffer = {
|
|
7
|
+
get device() {
|
|
8
|
+
var r = sniffer.os;
|
|
9
|
+
return r.isPc ? "pc" : "mobile";
|
|
10
|
+
},
|
|
11
|
+
get browser() {
|
|
12
|
+
if (typeof navigator === "undefined") {
|
|
13
|
+
return "";
|
|
14
|
+
}
|
|
15
|
+
var ua = navigator.userAgent.toLowerCase();
|
|
16
|
+
var reg = {
|
|
17
|
+
ie: /rv:([\d.]+)\) like gecko/,
|
|
18
|
+
firefox: /firefox\/([\d.]+)/,
|
|
19
|
+
chrome: /chrome\/([\d.]+)/,
|
|
20
|
+
opera: /opera.([\d.]+)/,
|
|
21
|
+
safari: /version\/([\d.]+).*safari/
|
|
22
|
+
};
|
|
23
|
+
return [].concat(Object.keys(reg).filter(function(key) {
|
|
24
|
+
return reg[key].test(ua);
|
|
25
|
+
}))[0];
|
|
26
|
+
},
|
|
27
|
+
get os() {
|
|
28
|
+
if (typeof navigator === "undefined") {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
var ua = navigator.userAgent;
|
|
32
|
+
var isWindowsPhone = /(?:Windows Phone)/.test(ua);
|
|
33
|
+
var isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone;
|
|
34
|
+
var isAndroid = /(?:Android)/.test(ua);
|
|
35
|
+
var isFireFox = /(?:Firefox)/.test(ua);
|
|
36
|
+
var isTablet = /(?:iPad|PlayBook)/.test(ua) || isAndroid && !/(?:Mobile)/.test(ua) || isFireFox && /(?:Tablet)/.test(ua);
|
|
37
|
+
var isPhone = /(?:iPhone)/.test(ua) && !isTablet;
|
|
38
|
+
var isPc = !isPhone && !isAndroid && !isSymbian && !isTablet;
|
|
39
|
+
var isIpad = /(?:iPad|PlayBook)/.test(ua);
|
|
40
|
+
return {
|
|
41
|
+
isTablet,
|
|
42
|
+
isPhone,
|
|
43
|
+
isIpad,
|
|
44
|
+
isIos: isPhone || isIpad,
|
|
45
|
+
isAndroid,
|
|
46
|
+
isPc,
|
|
47
|
+
isSymbian,
|
|
48
|
+
isWindowsPhone,
|
|
49
|
+
isFireFox
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
get osVersion() {
|
|
53
|
+
if (typeof navigator === "undefined") {
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
var ua = navigator.userAgent;
|
|
57
|
+
var reg = "";
|
|
58
|
+
if (/(?:iPhone)|(?:iPad|PlayBook)/.test(ua)) {
|
|
59
|
+
reg = VERSION_REG.ios;
|
|
60
|
+
} else {
|
|
61
|
+
reg = VERSION_REG.android;
|
|
62
|
+
}
|
|
63
|
+
var _match = reg ? reg.exec(ua) : [];
|
|
64
|
+
if (_match && _match.length >= 3) {
|
|
65
|
+
var version = _match[2].split(".");
|
|
66
|
+
return version.length > 0 ? parseInt(version[0]) : 0;
|
|
67
|
+
}
|
|
68
|
+
return 0;
|
|
69
|
+
},
|
|
70
|
+
get isWeixin() {
|
|
71
|
+
if (typeof navigator === "undefined") {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
var reg = /(micromessenger)\/([\d.]+)/;
|
|
75
|
+
var match = reg.exec(navigator.userAgent.toLocaleLowerCase());
|
|
76
|
+
if (match) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
},
|
|
81
|
+
isSupportMP4: function isSupportMP4() {
|
|
82
|
+
var result = {
|
|
83
|
+
isSupport: false,
|
|
84
|
+
mime: ""
|
|
85
|
+
};
|
|
86
|
+
if (typeof document === "undefined") {
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
if (this.supportResult) {
|
|
90
|
+
return this.supportResult;
|
|
91
|
+
}
|
|
92
|
+
var a = document.createElement("video");
|
|
93
|
+
if (typeof a.canPlayType === "function") {
|
|
94
|
+
H264_MIMETYPES.map(function(key) {
|
|
95
|
+
if (a.canPlayType('video/mp4; codecs="'.concat(key, '"')) === "probably") {
|
|
96
|
+
result.isSupport = true;
|
|
97
|
+
result.mime += "||".concat(key);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
this.supportResult = result;
|
|
102
|
+
a = null;
|
|
103
|
+
return result;
|
|
104
|
+
},
|
|
105
|
+
isMSESupport: function isMSESupport() {
|
|
106
|
+
var mime = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
|
|
107
|
+
if (typeof MediaSource === "undefined" || !MediaSource)
|
|
108
|
+
return false;
|
|
109
|
+
try {
|
|
110
|
+
return MediaSource.isTypeSupported(mime);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
this._logger.error(mime, error);
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
isHevcSupported: function isHevcSupported() {
|
|
117
|
+
if (typeof MediaSource === "undefined" || !MediaSource.isTypeSupported) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
return MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"') || MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"') || MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"') || MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"');
|
|
121
|
+
},
|
|
122
|
+
probeConfigSupported: function probeConfigSupported(info) {
|
|
123
|
+
var defaults = {
|
|
124
|
+
supported: false,
|
|
125
|
+
smooth: false,
|
|
126
|
+
powerEfficient: false
|
|
127
|
+
};
|
|
128
|
+
if (!info || typeof navigator === "undefined") {
|
|
129
|
+
return Promise.resolve(defaults);
|
|
130
|
+
}
|
|
131
|
+
if (navigator.mediaCapabilities && navigator.mediaCapabilities.decodingInfo) {
|
|
132
|
+
return navigator.mediaCapabilities.decodingInfo(info);
|
|
133
|
+
} else {
|
|
134
|
+
var videoConfig = info.video || {};
|
|
135
|
+
var audioConfig = info.audio || {};
|
|
136
|
+
try {
|
|
137
|
+
var videoSupported = MediaSource.isTypeSupported(videoConfig.contentType);
|
|
138
|
+
var audioSupported = MediaSource.isTypeSupported(audioConfig.contentType);
|
|
139
|
+
return Promise.resolve({
|
|
140
|
+
supported: videoSupported && audioSupported,
|
|
141
|
+
smooth: false,
|
|
142
|
+
powerEfficient: false
|
|
143
|
+
});
|
|
144
|
+
} catch (e) {
|
|
145
|
+
return Promise.resolve(defaults);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
export { sniffer as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getAbsoluteURL(url: any): any;
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
declare namespace util {
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param { string } el
|
|
5
|
+
* @param { string } [tpl=]
|
|
6
|
+
* @param { {[propName: string]: any }} [attrs={}]
|
|
7
|
+
* @param { string } [cname='']
|
|
8
|
+
* @returns { HTMLElement | null }
|
|
9
|
+
*/
|
|
10
|
+
function createDom(el?: string, tpl?: string, attrs?: {
|
|
11
|
+
[propName: string]: any;
|
|
12
|
+
}, cname?: string): HTMLElement;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param { string } html
|
|
16
|
+
* @param { string } [attrs={}]
|
|
17
|
+
* @param { string } [classname=""]
|
|
18
|
+
* @returns { HTMLElement | null }
|
|
19
|
+
*/
|
|
20
|
+
function createDomFromHtml(html: string, attrs?: string, classname?: string): HTMLElement;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param { HTMLElement } el
|
|
24
|
+
* @param { string } className
|
|
25
|
+
* @returns { boolean }
|
|
26
|
+
*/
|
|
27
|
+
function hasClass(el: HTMLElement, className: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param { HTMLElement } el
|
|
31
|
+
* @param { string } className
|
|
32
|
+
* @returns { void }
|
|
33
|
+
*/
|
|
34
|
+
function addClass(el: HTMLElement, className: string): void;
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param { HTMLElement } el
|
|
38
|
+
* @param { string } className
|
|
39
|
+
* @returns { void }
|
|
40
|
+
*/
|
|
41
|
+
function removeClass(el: HTMLElement, className: string): void;
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @param { HTMLElement } el
|
|
45
|
+
* @param { string } className
|
|
46
|
+
* @returns { void }
|
|
47
|
+
*/
|
|
48
|
+
function toggleClass(el: HTMLElement, className: string): void;
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @param { string | Object } args0
|
|
52
|
+
* @param { string } [className]
|
|
53
|
+
* @returns { string }
|
|
54
|
+
*/
|
|
55
|
+
function classNames(...args: any[]): string;
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @param { HTMLElement } el
|
|
59
|
+
* @param { string } sel
|
|
60
|
+
* @returns { HTMLElement }
|
|
61
|
+
*/
|
|
62
|
+
function findDom(el: HTMLElement, sel: string): HTMLElement;
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* @param { HTMLElement } dom
|
|
66
|
+
* @param { string } key
|
|
67
|
+
* @returns { any }
|
|
68
|
+
*/
|
|
69
|
+
function getCss(dom: HTMLElement, key: string): any;
|
|
70
|
+
function padStart(str: any, length: any, pad: any): string;
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* @param { number } time
|
|
74
|
+
* @returns { string }
|
|
75
|
+
*/
|
|
76
|
+
function format(time: number): string;
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
* @param { Object } e
|
|
80
|
+
* @returns { Object }
|
|
81
|
+
*/
|
|
82
|
+
function event(e: any): any;
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
* @param { any } obj
|
|
86
|
+
* @returns { string }
|
|
87
|
+
*/
|
|
88
|
+
function typeOf(obj: any): string;
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* @param { any } dst
|
|
92
|
+
* @param { any } src
|
|
93
|
+
* @returns { any }
|
|
94
|
+
*/
|
|
95
|
+
function deepCopy(dst: any, src: any): any;
|
|
96
|
+
/**
|
|
97
|
+
*
|
|
98
|
+
* @param { any } dst
|
|
99
|
+
* @param { any } src
|
|
100
|
+
* @returns { any }
|
|
101
|
+
*/
|
|
102
|
+
function deepMerge(dst: any, src: any): any;
|
|
103
|
+
function getBgImage(el: any): string;
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @param { HTMLElement } dom
|
|
107
|
+
* @returns { HTMLElement | null }
|
|
108
|
+
*/
|
|
109
|
+
function copyDom(dom: HTMLElement): HTMLElement;
|
|
110
|
+
/**
|
|
111
|
+
*
|
|
112
|
+
* @param { any } context
|
|
113
|
+
* @param { string } eventName
|
|
114
|
+
* @param { function } intervalFunc
|
|
115
|
+
* @param { number } frequency
|
|
116
|
+
*/
|
|
117
|
+
function setInterval(context: any, eventName: string, intervalFunc: Function, frequency: number): void;
|
|
118
|
+
/**
|
|
119
|
+
*
|
|
120
|
+
* @param { any } context
|
|
121
|
+
* @param { string } eventName
|
|
122
|
+
* @returns { void }
|
|
123
|
+
*/
|
|
124
|
+
function clearInterval(context: any, eventName: string): void;
|
|
125
|
+
/**
|
|
126
|
+
*
|
|
127
|
+
* @param { any } context
|
|
128
|
+
* @param { function } fun
|
|
129
|
+
* @param { number } time
|
|
130
|
+
* @returns { number }
|
|
131
|
+
*/
|
|
132
|
+
function setTimeout(context: any, fun: Function, time: number): number;
|
|
133
|
+
/**
|
|
134
|
+
*
|
|
135
|
+
* @param { any } context
|
|
136
|
+
* @param { number } id
|
|
137
|
+
*/
|
|
138
|
+
function clearTimeout(context: any, id: number): void;
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
* @param { any } context
|
|
142
|
+
*/
|
|
143
|
+
function clearAllTimers(context: any): void;
|
|
144
|
+
/**
|
|
145
|
+
*
|
|
146
|
+
* @param { string } name
|
|
147
|
+
* @param { string } imgUrl
|
|
148
|
+
* @param { number } [width]
|
|
149
|
+
* @param { number } [height]
|
|
150
|
+
* @returns { HTMLElement }
|
|
151
|
+
*/
|
|
152
|
+
function createImgBtn(name: string, imgUrl: string, width?: number, height?: number): HTMLElement;
|
|
153
|
+
/**
|
|
154
|
+
*
|
|
155
|
+
* @param { string } hex
|
|
156
|
+
* @param { string | number } alpha
|
|
157
|
+
* @returns { string }
|
|
158
|
+
*/
|
|
159
|
+
function Hex2RGBA(hex: string, alpha: string | number): string;
|
|
160
|
+
/**
|
|
161
|
+
*
|
|
162
|
+
* @returns { HTMLElement | null }
|
|
163
|
+
*/
|
|
164
|
+
function getFullScreenEl(): HTMLElement;
|
|
165
|
+
/**
|
|
166
|
+
* @param { any }
|
|
167
|
+
* @returns { boolean }
|
|
168
|
+
*/
|
|
169
|
+
function checkIsFunction(fun: any): boolean;
|
|
170
|
+
/**
|
|
171
|
+
* @param { any }
|
|
172
|
+
* @returns { boolean }
|
|
173
|
+
*/
|
|
174
|
+
function checkIsObject(obj: any): boolean;
|
|
175
|
+
/**
|
|
176
|
+
* @param { HTMLElement }
|
|
177
|
+
*/
|
|
178
|
+
function hide(dom: any): void;
|
|
179
|
+
/**
|
|
180
|
+
* @param { HTMLElement }
|
|
181
|
+
* @param { block | flex | inline-block | inline-flex } [display]
|
|
182
|
+
*/
|
|
183
|
+
function show(dom: any, display: any): void;
|
|
184
|
+
/**
|
|
185
|
+
*
|
|
186
|
+
* @param { any } val
|
|
187
|
+
* @returns { boolean }
|
|
188
|
+
*/
|
|
189
|
+
function isUndefined(val: any): boolean;
|
|
190
|
+
function isNotNull(val: any): boolean;
|
|
191
|
+
/**
|
|
192
|
+
*
|
|
193
|
+
* @param { HTMLElement } dom
|
|
194
|
+
* @param { string } [text]
|
|
195
|
+
* @returns
|
|
196
|
+
*/
|
|
197
|
+
function setStyleFromCsstext(dom: HTMLElement, text?: string): void;
|
|
198
|
+
/**
|
|
199
|
+
*
|
|
200
|
+
* @param { HTMLElement } dom
|
|
201
|
+
* @param { Array<string> } [list] attribute names to filter
|
|
202
|
+
* @returns { {} | {[propName: string]: any;} }
|
|
203
|
+
*/
|
|
204
|
+
function filterStyleFromText(dom: HTMLElement, list?: string[]): {} | {
|
|
205
|
+
[propName: string]: any;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
*
|
|
209
|
+
* @param { HTMLElement } dom
|
|
210
|
+
* @returns { {} | {[propName: string]: any;} }
|
|
211
|
+
*/
|
|
212
|
+
function getStyleFromCsstext(dom: HTMLElement): {} | {
|
|
213
|
+
[propName: string]: any;
|
|
214
|
+
};
|
|
215
|
+
function preloadImg(url: any, onload?: () => void, onerror?: () => void): void;
|
|
216
|
+
function stopPropagation(e: any): void;
|
|
217
|
+
function scrollTop(): number;
|
|
218
|
+
function scrollLeft(): number;
|
|
219
|
+
function checkTouchSupport(): boolean;
|
|
220
|
+
function getBuffered2(vbuffered: any, maxHoleDuration?: number): XgplayerTimeRange;
|
|
221
|
+
/**
|
|
222
|
+
* @description css中有zoom的时候,位移会等比缩放,但是元素的宽高不会等比缩放,所以通过该api做统一
|
|
223
|
+
* https://bugs.chromium.org/p/chromium/issues/detail?id=429140#c8
|
|
224
|
+
* @param {Events} e
|
|
225
|
+
* @param {number} zoom
|
|
226
|
+
* @returns
|
|
227
|
+
*/
|
|
228
|
+
function getEventPos(e: Events, zoom?: number): {
|
|
229
|
+
x: number;
|
|
230
|
+
y: number;
|
|
231
|
+
clientX: number;
|
|
232
|
+
clientY: number;
|
|
233
|
+
offsetX: number;
|
|
234
|
+
offsetY: number;
|
|
235
|
+
pageX: number;
|
|
236
|
+
pageY: number;
|
|
237
|
+
};
|
|
238
|
+
function requestAnimationFrame(callback: any): any;
|
|
239
|
+
function getHostFromUrl(url: any): string;
|
|
240
|
+
function cancelAnimationFrame(frameId: any): void;
|
|
241
|
+
/**
|
|
242
|
+
* @desc Check whether it is MediaSource start
|
|
243
|
+
* @param { HTMLVideoElement | HTMLAudioElement | HTMLElement } video
|
|
244
|
+
* @returns { Boolean }
|
|
245
|
+
*/
|
|
246
|
+
function isMSE(video: HTMLElement | HTMLVideoElement | HTMLAudioElement): boolean;
|
|
247
|
+
function isBlob(url: any): boolean;
|
|
248
|
+
/**
|
|
249
|
+
* @param { number } did
|
|
250
|
+
* @returns { string }
|
|
251
|
+
*/
|
|
252
|
+
function generateSessionId(did?: number): string;
|
|
253
|
+
function createEvent(eventName: any): Event;
|
|
254
|
+
/**
|
|
255
|
+
* @description Adjust currentTime according to duration, when ended is true and currentTime is less than duration, or
|
|
256
|
+
* currentTime is greater than duration, return duration
|
|
257
|
+
* @param { number } time
|
|
258
|
+
* @param { number } duration
|
|
259
|
+
* @param { boolean } isEnded
|
|
260
|
+
* @returns { number } Adjusted time
|
|
261
|
+
*/
|
|
262
|
+
function adjustTimeByDuration(time: number, duration: number, isEnded: boolean): number;
|
|
263
|
+
function createPositionBar(className: any, root: any): HTMLElement;
|
|
264
|
+
function getTransformStyle(pos?: {
|
|
265
|
+
x: number;
|
|
266
|
+
y: number;
|
|
267
|
+
scale: number;
|
|
268
|
+
rotate: number;
|
|
269
|
+
}, transformValue?: string): string;
|
|
270
|
+
/**
|
|
271
|
+
* @description 角度换算
|
|
272
|
+
* @param {number} val
|
|
273
|
+
* @returns {number}
|
|
274
|
+
*/
|
|
275
|
+
function convertDeg(val: number): number;
|
|
276
|
+
function getIndexByTime(time: any, segments: any): number;
|
|
277
|
+
function getOffsetCurrentTime(currentTime: any, segments: any, index?: number): any;
|
|
278
|
+
/**
|
|
279
|
+
*
|
|
280
|
+
* @param {*} offsetTime
|
|
281
|
+
* @param {*} segments
|
|
282
|
+
* @returns
|
|
283
|
+
*/
|
|
284
|
+
function getCurrentTimeByOffset(offsetTime: any, segments: any): any;
|
|
285
|
+
}
|
|
286
|
+
export function checkIsCurrentVideo(element: any, playerId: any, key: any): boolean;
|
|
287
|
+
export function debounce(func: any, wait: any, options: any): {
|
|
288
|
+
(...args: any[]): any;
|
|
289
|
+
cancel: () => void;
|
|
290
|
+
flush: () => any;
|
|
291
|
+
pending: () => boolean;
|
|
292
|
+
};
|
|
293
|
+
export function throttle(func: any, wait: any, options: any): {
|
|
294
|
+
(...args: any[]): any;
|
|
295
|
+
cancel: () => void;
|
|
296
|
+
flush: () => any;
|
|
297
|
+
pending: () => boolean;
|
|
298
|
+
};
|
|
299
|
+
/**
|
|
300
|
+
* @returns { string }
|
|
301
|
+
*/
|
|
302
|
+
export function getLang(): string;
|
|
303
|
+
import XgplayerTimeRange from "./xgplayerTimeRange";
|
|
304
|
+
export { util as default };
|