xgplayer 3.1.0-alpha.0 → 3.1.0-alpha.2
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 +11 -1
- package/dist/index.min.css +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/constant.d.ts +0 -4
- package/es/constant.js +4 -1
- package/es/defaultConfig.js +2 -0
- package/es/error.js +2 -2
- package/es/index.d.ts +2 -1
- package/es/index.js +4 -3
- package/es/index.umd.d.ts +60 -1
- package/es/index.umd.js +29 -1
- package/es/lang/i18n.js +4 -4
- package/es/mediaProxy.d.ts +8 -0
- package/es/mediaProxy.js +13 -8
- package/es/player.d.ts +119 -14
- package/es/player.js +669 -163
- package/es/plugin/basePlugin.d.ts +6 -3
- package/es/plugin/basePlugin.js +6 -5
- package/es/plugin/index.d.ts +2 -1
- package/es/plugin/plugin.d.ts +0 -1
- package/es/plugin/plugin.js +11 -11
- package/es/plugin/pluginsManager.d.ts +14 -0
- package/es/plugin/pluginsManager.js +32 -16
- package/es/plugin/resizeObserver.js +1 -1
- package/es/plugins/common/iconPlugin.js +1 -0
- package/es/plugins/common/optionList.js +10 -10
- package/es/plugins/common/optionsIcon.js +13 -9
- package/es/plugins/common/thumbnail.d.ts +0 -1
- package/es/plugins/common/thumbnail.js +3 -24
- package/es/plugins/controls/index.css +132 -0
- package/es/plugins/controls/index.js +189 -0
- package/es/plugins/cssFullScreen/index.js +2 -1
- package/es/plugins/danmu/danmuIcon.js +1 -0
- package/es/plugins/danmu/danmuPanel.js +2 -2
- package/es/plugins/danmu/index.js +4 -4
- package/es/plugins/definition/index.js +2 -2
- package/es/plugins/download/index.js +3 -3
- package/es/plugins/dynamicBg/index.js +5 -5
- package/es/plugins/enter/index.js +2 -2
- package/es/plugins/error/index.js +2 -1
- package/es/plugins/fpsDetect/index.js +2 -1
- package/es/plugins/fullscreen/backicon.js +3 -3
- package/es/plugins/fullscreen/index.js +2 -2
- package/es/plugins/gapJump/index.js +2 -1
- package/es/plugins/heatmap/index.css +25 -0
- package/es/plugins/heatmap/index.d.ts +70 -0
- package/es/plugins/heatmap/index.js +306 -0
- package/es/plugins/heatmap/index.scss +28 -0
- package/es/plugins/keyboard/index.js +3 -3
- package/es/plugins/logger/index.js +11 -11
- package/es/plugins/miniScreen/index.js +6 -6
- package/es/plugins/miniScreen/miniScreenIcon.js +1 -0
- package/es/plugins/mobile/index.js +14 -14
- package/es/plugins/pc/index.js +3 -3
- package/es/plugins/pip/index.d.ts +11 -1
- package/es/plugins/pip/index.js +112 -13
- package/es/plugins/play/index.js +2 -1
- package/es/plugins/playNext/index.js +2 -1
- package/es/plugins/playbackRate/index.js +2 -1
- package/es/plugins/poster/index.css +4 -0
- package/es/plugins/poster/index.js +12 -10
- package/es/plugins/poster/index.scss +4 -0
- package/es/plugins/progress/index.js +35 -33
- package/es/plugins/progress/innerList.js +11 -9
- package/es/plugins/progress/miniProgress.js +1 -0
- package/es/plugins/progressPreview/dotsApi.js +5 -5
- package/es/plugins/progressPreview/index.d.ts +2 -2
- package/es/plugins/progressPreview/index.js +29 -29
- package/es/plugins/prompt/index.js +5 -5
- package/es/plugins/replay/index.js +3 -3
- package/es/plugins/rotate/index.js +2 -2
- package/es/plugins/screenShot/index.d.ts +1 -0
- package/es/plugins/screenShot/index.js +8 -3
- package/es/plugins/start/index.js +13 -13
- package/es/plugins/stats/index.js +1 -1
- package/es/plugins/testspeed/index.js +2 -2
- package/es/plugins/time/index.js +34 -31
- package/es/plugins/time/timesegments.js +7 -7
- package/es/plugins/track/index.js +6 -6
- package/es/plugins/volume/index.js +15 -15
- package/es/plugins/waitingTimeoutJump/index.js +2 -1
- package/es/presets/default-en.d.ts +2 -1
- package/es/presets/default-en.js +6 -4
- package/es/presets/default.d.ts +3 -2
- package/es/presets/default.js +6 -4
- package/es/stateClassMap.d.ts +1 -0
- package/es/stateClassMap.js +1 -0
- package/es/utils/database.js +107 -0
- package/es/utils/util.d.ts +300 -282
- package/es/utils/util.js +352 -145
- package/es/utils/xgplayerTimeRange.d.ts +7 -0
- package/es/utils/xgplayerTimeRange.js +25 -0
- package/es/version.js +1 -1
- package/package.json +3 -10
- package/es/simple.umd.d.ts +0 -2
- package/es/utils/throttle.d.ts +0 -12
- package/es/utils/throttle.js +0 -132
package/es/constant.d.ts
CHANGED
|
@@ -2,7 +2,3 @@ export const FULLSCREEN_EVENTS: string[];
|
|
|
2
2
|
export const GET_FULLSCREEN_API: string[];
|
|
3
3
|
export const EXIT_FULLSCREEN_API: string[];
|
|
4
4
|
export const PLATER_ID: "data-xgplayerid";
|
|
5
|
-
export namespace FULL_EVENTS {
|
|
6
|
-
const webkitbeginfullscreen: string;
|
|
7
|
-
const webkitendfullscreen: string;
|
|
8
|
-
}
|
package/es/constant.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
var FULLSCREEN_EVENTS = ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange"];
|
|
2
|
+
var GET_FULLSCREEN_API = ["requestFullscreen", "webkitRequestFullscreen", "mozRequestFullScreen", "msRequestFullscreen"];
|
|
3
|
+
var EXIT_FULLSCREEN_API = ["exitFullscreen", "webkitExitFullscreen", "mozCancelFullScreen", "msExitFullscreen"];
|
|
1
4
|
var PLATER_ID = "data-xgplayerid";
|
|
2
|
-
export { PLATER_ID };
|
|
5
|
+
export { EXIT_FULLSCREEN_API, FULLSCREEN_EVENTS, GET_FULLSCREEN_API, PLATER_ID };
|
package/es/defaultConfig.js
CHANGED
package/es/error.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createClass as _createClass, classCallCheck as _classCallCheck } from "./_virtual/_rollupPluginBabelHelpers.js";
|
|
2
2
|
import version from "./version.js";
|
|
3
|
-
import
|
|
3
|
+
import util from "./utils/util.js";
|
|
4
4
|
var ERROR_TYPE_MAP = {
|
|
5
5
|
1: "media",
|
|
6
6
|
2: "media",
|
|
@@ -50,7 +50,7 @@ var Errors = /* @__PURE__ */ _createClass(
|
|
|
50
50
|
message: errorInfo.errorMessage || mediaError.message,
|
|
51
51
|
mediaError,
|
|
52
52
|
originError: errorInfo.originError ? errorInfo.originError.stack : "",
|
|
53
|
-
host: getHostFromUrl(src || currentSrc)
|
|
53
|
+
host: util.getHostFromUrl(src || currentSrc)
|
|
54
54
|
};
|
|
55
55
|
errorInfo.ext && Object.keys(errorInfo.ext).map(function(key) {
|
|
56
56
|
r[key] = errorInfo.ext[key];
|
package/es/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { default as langZhHk } from "./lang/zh-hk";
|
|
|
3
3
|
export { default as langJp } from "./lang/jp";
|
|
4
4
|
export { default as langZhCn } from "./lang/zh-cn";
|
|
5
5
|
export { default as TextTrack } from "./plugins/track";
|
|
6
|
+
export { default as HeatMap } from "./plugins/heatmap";
|
|
6
7
|
export type IPlayerOptions = import('./defaultConfig').IPlayerOptions;
|
|
7
8
|
export type IDefinition = import('./defaultConfig').IDefinition;
|
|
8
9
|
export type IVideoProxy = any;
|
|
@@ -17,7 +18,7 @@ import Plugin from "./plugin/plugin";
|
|
|
17
18
|
import * as Events from "./events";
|
|
18
19
|
import Errors from "./error";
|
|
19
20
|
import Sniffer from "./utils/sniffer";
|
|
20
|
-
import
|
|
21
|
+
import Util from "./utils/util";
|
|
21
22
|
import STATE_CLASS from "./stateClassMap";
|
|
22
23
|
import I18N from "./lang/i18n";
|
|
23
24
|
import { STATES } from "./state";
|
package/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as SimplePlayer
|
|
1
|
+
export { default as SimplePlayer } from "./player.js";
|
|
2
2
|
export { default as Plugin } from "./plugin/plugin.js";
|
|
3
3
|
export { default as BasePlugin } from "./plugin/basePlugin.js";
|
|
4
4
|
import * as events from "./events.js";
|
|
@@ -7,8 +7,8 @@ export { default as STATE_CLASS } from "./stateClassMap.js";
|
|
|
7
7
|
export { default as I18N } from "./lang/i18n.js";
|
|
8
8
|
export { default as Errors } from "./error.js";
|
|
9
9
|
export { default as Sniffer } from "./utils/sniffer.js";
|
|
10
|
-
|
|
11
|
-
export {
|
|
10
|
+
export { default as Util } from "./utils/util.js";
|
|
11
|
+
export { default } from "./index.umd.js";
|
|
12
12
|
export { STATES } from "./state.js";
|
|
13
13
|
export { default as DefaultPresetEn } from "./presets/default-en.js";
|
|
14
14
|
export { default as DefaultPreset } from "./presets/default.js";
|
|
@@ -19,5 +19,6 @@ export { default as langJp } from "./lang/jp.js";
|
|
|
19
19
|
export { default as langZhCn } from "./lang/zh-cn.js";
|
|
20
20
|
export { default as Danmu } from "./plugins/danmu/index.js";
|
|
21
21
|
export { default as TextTrack } from "./plugins/track/index.js";
|
|
22
|
+
export { default as HeatMap } from "./plugins/heatmap/index.js";
|
|
22
23
|
export { default as DanmuIcon } from "./plugins/danmu/danmuIcon.js";
|
|
23
24
|
export { default as DanmuPanel } from "./plugins/danmu/danmuPanel.js";
|
package/es/index.umd.d.ts
CHANGED
|
@@ -1,2 +1,61 @@
|
|
|
1
|
-
export default
|
|
1
|
+
export default PresetPlayer;
|
|
2
|
+
declare class PresetPlayer extends Player {
|
|
3
|
+
static defaultPreset: typeof defaultPreset;
|
|
4
|
+
static Util: typeof Util;
|
|
5
|
+
static Sniffer: import("./utils/sniffer").ISniffer;
|
|
6
|
+
static Errors: typeof Errors;
|
|
7
|
+
static Events: typeof Events;
|
|
8
|
+
static Plugin: typeof Plugin;
|
|
9
|
+
static BasePlugin: typeof BasePlugin;
|
|
10
|
+
static I18N: {
|
|
11
|
+
readonly textKeys: any[];
|
|
12
|
+
readonly langKeys: string[];
|
|
13
|
+
readonly lang: {
|
|
14
|
+
[propName: string]: {
|
|
15
|
+
[propName: string]: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
extend: (I18nText: import("./lang/i18n").IXGI18nText) => {};
|
|
19
|
+
use: (lang: import("./lang/i18n").IXGI18nText) => {};
|
|
20
|
+
init: (id: any) => import("./lang/i18n").IXGI18n;
|
|
21
|
+
};
|
|
22
|
+
static STATE_CLASS: {
|
|
23
|
+
DEFAULT: string;
|
|
24
|
+
DEFAULT_SKIN: string;
|
|
25
|
+
ENTER: string;
|
|
26
|
+
PAUSED: string;
|
|
27
|
+
PLAYING: string;
|
|
28
|
+
ENDED: string;
|
|
29
|
+
CANPLAY: string;
|
|
30
|
+
LOADING: string;
|
|
31
|
+
ERROR: string;
|
|
32
|
+
REPLAY: string;
|
|
33
|
+
NO_START: string;
|
|
34
|
+
ACTIVE: string;
|
|
35
|
+
INACTIVE: string;
|
|
36
|
+
FULLSCREEN: string;
|
|
37
|
+
CSS_FULLSCREEN: string;
|
|
38
|
+
ROTATE_FULLSCREEN: string;
|
|
39
|
+
PARENT_ROTATE_FULLSCREEN: string;
|
|
40
|
+
PARENT_FULLSCREEN: string;
|
|
41
|
+
INNER_FULLSCREEN: string;
|
|
42
|
+
NO_CONTROLS: string;
|
|
43
|
+
FLEX_CONTROLS: string;
|
|
44
|
+
CONTROLS_FOLLOW: string;
|
|
45
|
+
CONTROLS_AUTOHIDE: string;
|
|
46
|
+
TOP_BAR_AUTOHIDE: string;
|
|
47
|
+
NOT_ALLOW_AUTOPLAY: string;
|
|
48
|
+
SEEKING: string;
|
|
49
|
+
PC: string;
|
|
50
|
+
BUILTIN_CLASS: string;
|
|
51
|
+
MOBILE: string;
|
|
52
|
+
MINI: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
2
55
|
import Player from "./player";
|
|
56
|
+
import defaultPreset from "./presets/default";
|
|
57
|
+
import Util from "./utils/util";
|
|
58
|
+
import Errors from "./error";
|
|
59
|
+
import * as Events from "./events";
|
|
60
|
+
import Plugin from "./plugin/plugin";
|
|
61
|
+
import BasePlugin from "./plugin/basePlugin";
|
package/es/index.umd.js
CHANGED
|
@@ -1,2 +1,30 @@
|
|
|
1
|
+
import { defineProperty as _defineProperty, inherits as _inherits, createSuper as _createSuper, createClass as _createClass, classCallCheck as _classCallCheck } from "./_virtual/_rollupPluginBabelHelpers.js";
|
|
1
2
|
import Player from "./player.js";
|
|
2
|
-
|
|
3
|
+
import Plugin from "./plugin/plugin.js";
|
|
4
|
+
import BasePlugin from "./plugin/basePlugin.js";
|
|
5
|
+
import * as events from "./events.js";
|
|
6
|
+
import STATE_CLASS from "./stateClassMap.js";
|
|
7
|
+
import I18N from "./lang/i18n.js";
|
|
8
|
+
import Errors from "./error.js";
|
|
9
|
+
import sniffer from "./utils/sniffer.js";
|
|
10
|
+
import util from "./utils/util.js";
|
|
11
|
+
import DefaultPreset from "./presets/default.js";
|
|
12
|
+
var PresetPlayer = /* @__PURE__ */ function(_Player) {
|
|
13
|
+
_inherits(PresetPlayer2, _Player);
|
|
14
|
+
var _super = _createSuper(PresetPlayer2);
|
|
15
|
+
function PresetPlayer2() {
|
|
16
|
+
_classCallCheck(this, PresetPlayer2);
|
|
17
|
+
return _super.apply(this, arguments);
|
|
18
|
+
}
|
|
19
|
+
return _createClass(PresetPlayer2);
|
|
20
|
+
}(Player);
|
|
21
|
+
_defineProperty(PresetPlayer, "defaultPreset", DefaultPreset);
|
|
22
|
+
_defineProperty(PresetPlayer, "Util", util);
|
|
23
|
+
_defineProperty(PresetPlayer, "Sniffer", sniffer);
|
|
24
|
+
_defineProperty(PresetPlayer, "Errors", Errors);
|
|
25
|
+
_defineProperty(PresetPlayer, "Events", events);
|
|
26
|
+
_defineProperty(PresetPlayer, "Plugin", Plugin);
|
|
27
|
+
_defineProperty(PresetPlayer, "BasePlugin", BasePlugin);
|
|
28
|
+
_defineProperty(PresetPlayer, "I18N", I18N);
|
|
29
|
+
_defineProperty(PresetPlayer, "STATE_CLASS", STATE_CLASS);
|
|
30
|
+
export { PresetPlayer as default };
|
package/es/lang/i18n.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toConsumableArray as _toConsumableArray } from "../_virtual/_rollupPluginBabelHelpers.js";
|
|
2
|
-
import
|
|
2
|
+
import util from "../utils/util.js";
|
|
3
3
|
import EN from "./en.js";
|
|
4
4
|
var XGI18nLang = {
|
|
5
5
|
lang: {},
|
|
@@ -8,8 +8,8 @@ var XGI18nLang = {
|
|
|
8
8
|
};
|
|
9
9
|
function deepMerge(dst, src) {
|
|
10
10
|
Object.keys(src).forEach(function(key) {
|
|
11
|
-
var _s = typeOf(src[key]);
|
|
12
|
-
var _t = typeOf(dst[key]);
|
|
11
|
+
var _s = util.typeOf(src[key]);
|
|
12
|
+
var _t = util.typeOf(dst[key]);
|
|
13
13
|
if (_s === "Array") {
|
|
14
14
|
var _dst$key;
|
|
15
15
|
if (_t !== "Array") {
|
|
@@ -40,7 +40,7 @@ function extend(i18nTextList, i18nLangs) {
|
|
|
40
40
|
if (!i18nLangs.lang) {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
if (typeOf(i18nTextList) !== "Array") {
|
|
43
|
+
if (util.typeOf(i18nTextList) !== "Array") {
|
|
44
44
|
ext = Object.keys(i18nTextList).map(function(lang2) {
|
|
45
45
|
var keyLang = lang2 === "zh" ? "zh-cn" : lang2;
|
|
46
46
|
return {
|
package/es/mediaProxy.d.ts
CHANGED
|
@@ -182,6 +182,14 @@ declare class MediaProxy {
|
|
|
182
182
|
* @description 返回当前缓冲的TimeRange对象集合
|
|
183
183
|
*/
|
|
184
184
|
get buffered(): TimeRanges;
|
|
185
|
+
/**
|
|
186
|
+
* @type { Array<{start: number, end: number}> | null}
|
|
187
|
+
* @description 返回当前自定义的缓存列表
|
|
188
|
+
*/
|
|
189
|
+
get buffered2(): {
|
|
190
|
+
start: number;
|
|
191
|
+
end: number;
|
|
192
|
+
}[];
|
|
185
193
|
/**
|
|
186
194
|
* @type { {start: number, end: number} }
|
|
187
195
|
*/
|
package/es/mediaProxy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, createClass as _createClass, defineProperty as _defineProperty, get as _get, getPrototypeOf as _getPrototypeOf } from "./_virtual/_rollupPluginBabelHelpers.js";
|
|
2
2
|
import EventEmitter from "eventemitter3";
|
|
3
|
-
import
|
|
3
|
+
import util from "./utils/util.js";
|
|
4
4
|
import sniffer from "./utils/sniffer.js";
|
|
5
5
|
import Errors, { ERROR_TYPE_MAP } from "./error.js";
|
|
6
6
|
import { VIDEO_EVENTS, SOURCE_SUCCESS, SOURCE_ERROR, URL_CHANGE, WAITING } from "./events.js";
|
|
@@ -29,7 +29,7 @@ function getVideoEventHandler(eventKey, player) {
|
|
|
29
29
|
isInternalOp: !!player._internalOp[e.type],
|
|
30
30
|
muted: player.muted,
|
|
31
31
|
volume: player.volume,
|
|
32
|
-
host: getHostFromUrl(player.currentSrc),
|
|
32
|
+
host: util.getHostFromUrl(player.currentSrc),
|
|
33
33
|
vtype: player.vtype
|
|
34
34
|
};
|
|
35
35
|
player.removeInnerOP(e.type);
|
|
@@ -107,11 +107,11 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
107
107
|
if (options.autoplayMuted && !Object.prototype.hasOwnProperty.call(_this.mediaConfig, "muted")) {
|
|
108
108
|
_this.mediaConfig.muted = true;
|
|
109
109
|
}
|
|
110
|
-
_this.media = createDom(_this.mediaConfig.mediaType, "", _this.mediaConfig, "");
|
|
110
|
+
_this.media = util.createDom(_this.mediaConfig.mediaType, "", _this.mediaConfig, "");
|
|
111
111
|
if (options.defaultPlaybackRate) {
|
|
112
112
|
_this.media.defaultPlaybackRate = _this.media.playbackRate = options.defaultPlaybackRate;
|
|
113
113
|
}
|
|
114
|
-
if (typeOf(options.volume) === "Number") {
|
|
114
|
+
if (util.typeOf(options.volume) === "Number") {
|
|
115
115
|
_this.volume = options.volume;
|
|
116
116
|
}
|
|
117
117
|
if (options.autoplayMuted) {
|
|
@@ -186,7 +186,7 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
186
186
|
video.removeAttribute("src");
|
|
187
187
|
video.load();
|
|
188
188
|
urls.forEach(function(item, index) {
|
|
189
|
-
_this6.media.appendChild(createDom("source", "", {
|
|
189
|
+
_this6.media.appendChild(util.createDom("source", "", {
|
|
190
190
|
src: "".concat(item.src),
|
|
191
191
|
type: "".concat(item.type || ""),
|
|
192
192
|
"data-index": index + 1
|
|
@@ -201,7 +201,7 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
201
201
|
this._vLoadeddata = function(e) {
|
|
202
202
|
_this6.emit(SOURCE_SUCCESS, {
|
|
203
203
|
src: e.target.currentSrc,
|
|
204
|
-
host: getHostFromUrl(e.target.currentSrc)
|
|
204
|
+
host: util.getHostFromUrl(e.target.currentSrc)
|
|
205
205
|
});
|
|
206
206
|
};
|
|
207
207
|
var _eHandler = null;
|
|
@@ -369,6 +369,11 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
369
369
|
get: function get() {
|
|
370
370
|
return this.media ? this.media.buffered : null;
|
|
371
371
|
}
|
|
372
|
+
}, {
|
|
373
|
+
key: "buffered2",
|
|
374
|
+
get: function get() {
|
|
375
|
+
return this.media && this.media.buffered ? util.getBuffered2(this.media.buffered) : null;
|
|
376
|
+
}
|
|
372
377
|
}, {
|
|
373
378
|
key: "bufferedPoint",
|
|
374
379
|
get: function get() {
|
|
@@ -536,12 +541,12 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
536
541
|
this.emit(WAITING);
|
|
537
542
|
this._currentTime = 0;
|
|
538
543
|
this._duration = 0;
|
|
539
|
-
if (isMSE(this.media)) {
|
|
544
|
+
if (util.isMSE(this.media)) {
|
|
540
545
|
this.onWaiting();
|
|
541
546
|
return;
|
|
542
547
|
}
|
|
543
548
|
this._detachSourceEvents(this.media);
|
|
544
|
-
if (typeOf(url) === "Array") {
|
|
549
|
+
if (util.typeOf(url) === "Array") {
|
|
545
550
|
this._attachSourceEvents(this.media, url);
|
|
546
551
|
} else if (url) {
|
|
547
552
|
this.media.src = url;
|
package/es/player.d.ts
CHANGED
|
@@ -34,6 +34,16 @@ declare class Player extends MediaProxy {
|
|
|
34
34
|
* @returns {MediaCapabilitiesDecodingInfo}
|
|
35
35
|
*/
|
|
36
36
|
static probeConfigSupported(info: MediaDecodingConfiguration): MediaCapabilitiesDecodingInfo;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated
|
|
39
|
+
* 插件全部迁移完成再做删除
|
|
40
|
+
*/
|
|
41
|
+
static install(name: any, descriptor: any): void;
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated
|
|
44
|
+
* 插件全部迁移完成再做删除
|
|
45
|
+
*/
|
|
46
|
+
static use(name: any, descriptor: any): void;
|
|
37
47
|
static defaultPreset: any;
|
|
38
48
|
/**
|
|
39
49
|
* @description 自定义media构造函数
|
|
@@ -84,6 +94,12 @@ declare class Player extends MediaProxy {
|
|
|
84
94
|
* @readonly
|
|
85
95
|
*/
|
|
86
96
|
private readonly _useAutoplay;
|
|
97
|
+
/**
|
|
98
|
+
* @description 记录起播需要seek的时间点
|
|
99
|
+
* @private
|
|
100
|
+
* @readonly
|
|
101
|
+
*/
|
|
102
|
+
private readonly __startTime;
|
|
87
103
|
/**
|
|
88
104
|
* @type { number }
|
|
89
105
|
*/
|
|
@@ -183,12 +199,6 @@ declare class Player extends MediaProxy {
|
|
|
183
199
|
* @description 控制栏和video不同布局的时候内部容器
|
|
184
200
|
*/
|
|
185
201
|
readonly innerContainer: null | HTMLElement;
|
|
186
|
-
/**
|
|
187
|
-
* @type { null | Object }
|
|
188
|
-
* @readonly
|
|
189
|
-
* @description 控制栏插件
|
|
190
|
-
*/
|
|
191
|
-
readonly controls: null | any;
|
|
192
202
|
/**
|
|
193
203
|
* @type { null | HTMLElement }
|
|
194
204
|
* @readonly
|
|
@@ -200,6 +210,12 @@ declare class Player extends MediaProxy {
|
|
|
200
210
|
* @description 当前播放器根节点
|
|
201
211
|
*/
|
|
202
212
|
readonly root: null | HTMLElement;
|
|
213
|
+
__i18n: import("./lang/i18n").IXGI18n;
|
|
214
|
+
/**
|
|
215
|
+
* @readonly
|
|
216
|
+
* @type {any}
|
|
217
|
+
*/
|
|
218
|
+
readonly database: any;
|
|
203
219
|
/**
|
|
204
220
|
* @readonly
|
|
205
221
|
* @type { boolean }
|
|
@@ -301,20 +317,14 @@ declare class Player extends MediaProxy {
|
|
|
301
317
|
/**
|
|
302
318
|
*
|
|
303
319
|
* @param { any } plugin
|
|
304
|
-
* @param { boolean } removedFromConfig
|
|
305
320
|
*/
|
|
306
|
-
deregister(plugin: any
|
|
321
|
+
deregister(plugin: any): void;
|
|
307
322
|
/**
|
|
308
323
|
*
|
|
309
324
|
* @param { any } plugin
|
|
310
325
|
* @param { boolean } removedFromConfig
|
|
311
326
|
*/
|
|
312
327
|
unRegisterPlugin(plugin: any, removedFromConfig?: boolean): void;
|
|
313
|
-
/**
|
|
314
|
-
* @description 从当前config.plugins中移除插件
|
|
315
|
-
* @param {*} plugin
|
|
316
|
-
* @returns
|
|
317
|
-
*/
|
|
318
328
|
removePluginFromConfig(plugin: any): void;
|
|
319
329
|
/**
|
|
320
330
|
* 当前播放器挂载的插件实例列表
|
|
@@ -437,6 +447,62 @@ declare class Player extends MediaProxy {
|
|
|
437
447
|
reset(unregisterPlugins?: Array<string>, isResetConfig?: boolean): void;
|
|
438
448
|
replay(): void;
|
|
439
449
|
retry(): void;
|
|
450
|
+
/**
|
|
451
|
+
*
|
|
452
|
+
* @param { HTMLElement } root
|
|
453
|
+
* @param { HTMLElement } [el]
|
|
454
|
+
* @param { string } [rootClass]
|
|
455
|
+
* @param { string } [pClassName]
|
|
456
|
+
*/
|
|
457
|
+
changeFullStyle(root: HTMLElement, el?: HTMLElement, rootClass?: string, pClassName?: string): void;
|
|
458
|
+
/**
|
|
459
|
+
* @private
|
|
460
|
+
*/
|
|
461
|
+
private _orgPCss;
|
|
462
|
+
/**
|
|
463
|
+
*
|
|
464
|
+
* @param { HTMLElement } root
|
|
465
|
+
* @param { HTMLElement } [el]
|
|
466
|
+
* @param { string } [rootClass]
|
|
467
|
+
* @param { string } [pClassName]
|
|
468
|
+
*/
|
|
469
|
+
recoverFullStyle(root: HTMLElement, el?: HTMLElement, rootClass?: string, pClassName?: string): void;
|
|
470
|
+
/**
|
|
471
|
+
* @param { HTMLElement } [el]
|
|
472
|
+
* @returns { Promise<void> }
|
|
473
|
+
*/
|
|
474
|
+
getFullscreen(el?: HTMLElement): Promise<void>;
|
|
475
|
+
/**
|
|
476
|
+
* @private
|
|
477
|
+
*/
|
|
478
|
+
private _fullActionFrom;
|
|
479
|
+
/**
|
|
480
|
+
* @param { HTMLElement } [el]
|
|
481
|
+
* @returns { Promise<void> }
|
|
482
|
+
*/
|
|
483
|
+
exitFullscreen(el?: HTMLElement): Promise<void>;
|
|
484
|
+
/**
|
|
485
|
+
* @param { HTMLElement } [el]
|
|
486
|
+
* @returns
|
|
487
|
+
*/
|
|
488
|
+
getCssFullscreen(el?: HTMLElement): void;
|
|
489
|
+
/**
|
|
490
|
+
* @param { HTMLElement } [el]
|
|
491
|
+
* @returns
|
|
492
|
+
*/
|
|
493
|
+
exitCssFullscreen(): void;
|
|
494
|
+
/**
|
|
495
|
+
* 进入旋转全屏
|
|
496
|
+
* @param { HTMLElement } [el]
|
|
497
|
+
*/
|
|
498
|
+
getRotateFullscreen(el?: HTMLElement): void;
|
|
499
|
+
_rootStyle: string | boolean;
|
|
500
|
+
/**
|
|
501
|
+
* 退出旋转全屏
|
|
502
|
+
* @param { HTMLElement } [el]
|
|
503
|
+
*/
|
|
504
|
+
exitRotateFullscreen(el?: HTMLElement): void;
|
|
505
|
+
setRotateDeg(deg: any): void;
|
|
440
506
|
/**
|
|
441
507
|
* @description 播放器焦点状态,控制栏显示
|
|
442
508
|
* @param { {
|
|
@@ -476,11 +542,18 @@ declare class Player extends MediaProxy {
|
|
|
476
542
|
ignorePaused?: boolean;
|
|
477
543
|
}): void;
|
|
478
544
|
canPlayFunc: () => void;
|
|
545
|
+
/**
|
|
546
|
+
*
|
|
547
|
+
*/
|
|
548
|
+
onFullscreenChange: (event: any, isFullScreen: any) => void;
|
|
549
|
+
_onWebkitbeginfullscreen: (e: any) => void;
|
|
550
|
+
_onWebkitendfullscreen: (e: any) => void;
|
|
479
551
|
onEmptied(): void;
|
|
480
552
|
/**
|
|
481
553
|
* @protected
|
|
482
554
|
*/
|
|
483
555
|
protected onCanplay(): void;
|
|
556
|
+
onDurationchange(): void;
|
|
484
557
|
onLoadeddata(): void;
|
|
485
558
|
onLoadstart(): void;
|
|
486
559
|
/**
|
|
@@ -536,6 +609,18 @@ declare class Player extends MediaProxy {
|
|
|
536
609
|
* @returns { boolean }
|
|
537
610
|
*/
|
|
538
611
|
checkBuffer(time: number): boolean;
|
|
612
|
+
resizePosition(): void;
|
|
613
|
+
/**
|
|
614
|
+
* @description position video/audio according to height ratio and y coordinate
|
|
615
|
+
* @param { { h: number, y?: number, x?:number, w?:number} } pos
|
|
616
|
+
* @returns
|
|
617
|
+
*/
|
|
618
|
+
position(pos?: {
|
|
619
|
+
h: number;
|
|
620
|
+
y?: number;
|
|
621
|
+
x?: number;
|
|
622
|
+
w?: number;
|
|
623
|
+
}): void;
|
|
539
624
|
/**
|
|
540
625
|
* @description Update configuration parameters
|
|
541
626
|
* @param { IPlayerOptions } config
|
|
@@ -608,9 +693,21 @@ declare class Player extends MediaProxy {
|
|
|
608
693
|
droppedRate: number;
|
|
609
694
|
droppedDuration: number;
|
|
610
695
|
};
|
|
696
|
+
/**
|
|
697
|
+
* @type { null | Object }
|
|
698
|
+
* @readonly
|
|
699
|
+
* @description 控制栏插件
|
|
700
|
+
*/
|
|
701
|
+
readonly get controls(): any;
|
|
611
702
|
/**
|
|
612
703
|
* @type { string }
|
|
613
704
|
*/
|
|
705
|
+
set lang(arg: string);
|
|
706
|
+
get lang(): string;
|
|
707
|
+
get i18n(): import("./lang/i18n").IXGI18nText;
|
|
708
|
+
get i18nKeys(): {
|
|
709
|
+
[propName: string]: string;
|
|
710
|
+
};
|
|
614
711
|
/**
|
|
615
712
|
* @type { string }
|
|
616
713
|
*/
|
|
@@ -651,6 +748,12 @@ declare class Player extends MediaProxy {
|
|
|
651
748
|
* @type { number }
|
|
652
749
|
*/
|
|
653
750
|
get zoom(): number;
|
|
751
|
+
/**
|
|
752
|
+
* @type {number}
|
|
753
|
+
* @description Media element rotation angle, Only multiples of 90 degrees are supported
|
|
754
|
+
*/
|
|
755
|
+
set videoRotateDeg(arg: number);
|
|
756
|
+
get videoRotateDeg(): number;
|
|
654
757
|
/**
|
|
655
758
|
* @description 均衡下载速度,单位kb/s, 根据10条最新下载速度计算出来的加权值,如果没有测速能力则默认是0
|
|
656
759
|
* @type { number }
|
|
@@ -722,6 +825,8 @@ import BasePlugin from "./plugin/basePlugin";
|
|
|
722
825
|
import * as Events from "./events";
|
|
723
826
|
import Errors from "./error";
|
|
724
827
|
import Sniffer from "./utils/sniffer";
|
|
828
|
+
import Util from "./utils/util";
|
|
725
829
|
import STATE_CLASS from "./stateClassMap";
|
|
830
|
+
import I18N from "./lang/i18n";
|
|
726
831
|
import MediaProxy from "./mediaProxy";
|
|
727
|
-
export { Player as default, Plugin, BasePlugin, Events, Errors, Sniffer, STATE_CLASS };
|
|
832
|
+
export { Player as default, Plugin, BasePlugin, Events, Errors, Sniffer, Util, STATE_CLASS, I18N };
|