@byteplus/veplayer 2.11.1 → 2.12.0-rc.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/esm/veplayer.biz.live.development.js +37 -3
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +6 -2
- package/esm/veplayer.development.css +21 -5
- package/esm/veplayer.development.js +407 -4
- package/esm/veplayer.live.d.ts +6 -2
- package/esm/veplayer.live.development.css +21 -5
- package/esm/veplayer.live.development.js +407 -4
- package/esm/veplayer.live.production.css +1 -1
- package/esm/veplayer.live.production.js +3 -3
- package/esm/veplayer.production.css +1 -1
- package/esm/veplayer.production.js +3 -3
- package/esm/veplayer.vod.development.css +21 -5
- package/esm/veplayer.vod.development.js +370 -1
- package/esm/veplayer.vod.production.css +1 -1
- package/esm/veplayer.vod.production.js +3 -3
- package/package.json +1 -1
- package/umd/veplayer.biz.live.development.js +37 -3
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.d.ts +6 -2
- package/umd/veplayer.development.css +21 -5
- package/umd/veplayer.development.js +407 -4
- package/umd/veplayer.live.d.ts +6 -2
- package/umd/veplayer.live.development.css +21 -5
- package/umd/veplayer.live.development.js +407 -4
- package/umd/veplayer.live.production.css +1 -1
- package/umd/veplayer.live.production.js +1 -1
- package/umd/veplayer.production.css +1 -1
- package/umd/veplayer.production.js +1 -1
- package/umd/veplayer.vod.development.css +21 -5
- package/umd/veplayer.vod.development.js +370 -1
- package/umd/veplayer.vod.production.css +1 -1
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +6 -2
- package/veplayer.live.d.ts +6 -2
|
@@ -659,6 +659,22 @@
|
|
|
659
659
|
.xgplayer-pc.xgplayer-is-error .xgplayer-start {
|
|
660
660
|
display: none;
|
|
661
661
|
}
|
|
662
|
+
.xgplayer-mobile.xgplayer-mobile-mini-window video,
|
|
663
|
+
.xgplayer-mobile.xgplayer-mobile-mini-window xg-video {
|
|
664
|
+
position: fixed;
|
|
665
|
+
top: 0;
|
|
666
|
+
left: 0;
|
|
667
|
+
z-index: 9999;
|
|
668
|
+
/* stylelint-disable-next-line declaration-no-important */
|
|
669
|
+
width: 100vw !important;
|
|
670
|
+
/* stylelint-disable-next-line declaration-no-important */
|
|
671
|
+
height: 100vh !important;
|
|
672
|
+
}
|
|
673
|
+
.xgplayer-mobile.xgplayer-mobile-mini-window .xgplayer-start {
|
|
674
|
+
position: fixed;
|
|
675
|
+
/* stylelint-disable-next-line declaration-no-important */
|
|
676
|
+
z-index: 10000 !important;
|
|
677
|
+
}
|
|
662
678
|
.xgplayer-mobile .xgplayer-progress .xgplayer-progress-played {
|
|
663
679
|
background: #3469ff;
|
|
664
680
|
}
|
|
@@ -701,15 +717,15 @@
|
|
|
701
717
|
display: none;
|
|
702
718
|
}
|
|
703
719
|
.veplayer-logo {
|
|
704
|
-
display: none;
|
|
705
720
|
position: absolute;
|
|
706
|
-
|
|
721
|
+
top: 20px;
|
|
722
|
+
right: 20px;
|
|
723
|
+
z-index: 10;
|
|
724
|
+
display: none;
|
|
707
725
|
width: 70px;
|
|
708
726
|
height: 20px;
|
|
709
|
-
|
|
710
|
-
top: 20px;
|
|
727
|
+
visibility: visible;
|
|
711
728
|
opacity: 1;
|
|
712
|
-
z-index: 10;
|
|
713
729
|
}
|
|
714
730
|
.veplayer-logo svg {
|
|
715
731
|
width: 100%;
|
|
@@ -14153,6 +14153,373 @@ var __publicField = (obj, key, value) => {
|
|
|
14153
14153
|
replaceAttributes(this._el, this._videoAttributes);
|
|
14154
14154
|
}
|
|
14155
14155
|
}
|
|
14156
|
+
var Web2NativeMessageEvent = /* @__PURE__ */ ((Web2NativeMessageEvent2) => {
|
|
14157
|
+
Web2NativeMessageEvent2[Web2NativeMessageEvent2["INIT_FINISH"] = 10001] = "INIT_FINISH";
|
|
14158
|
+
Web2NativeMessageEvent2[Web2NativeMessageEvent2["CREATE_PLAYER"] = 11e3] = "CREATE_PLAYER";
|
|
14159
|
+
Web2NativeMessageEvent2[Web2NativeMessageEvent2["DESTROY_PLAYER"] = 11001] = "DESTROY_PLAYER";
|
|
14160
|
+
Web2NativeMessageEvent2[Web2NativeMessageEvent2["OPEN_FULLSCREEN"] = 11002] = "OPEN_FULLSCREEN";
|
|
14161
|
+
Web2NativeMessageEvent2[Web2NativeMessageEvent2["EXIT_FULLSCREEN"] = 11003] = "EXIT_FULLSCREEN";
|
|
14162
|
+
Web2NativeMessageEvent2[Web2NativeMessageEvent2["LIVE_ROOM_STATE_CHANGE"] = 11004] = "LIVE_ROOM_STATE_CHANGE";
|
|
14163
|
+
Web2NativeMessageEvent2[Web2NativeMessageEvent2["PLAYER_STATE_CHANGE"] = 11005] = "PLAYER_STATE_CHANGE";
|
|
14164
|
+
Web2NativeMessageEvent2[Web2NativeMessageEvent2["MEDIA_LOAD_FINISH"] = 11006] = "MEDIA_LOAD_FINISH";
|
|
14165
|
+
Web2NativeMessageEvent2[Web2NativeMessageEvent2["OPEN_MINI_WINDOW"] = 11007] = "OPEN_MINI_WINDOW";
|
|
14166
|
+
Web2NativeMessageEvent2[Web2NativeMessageEvent2["CLOSE_MINI_WINDOW"] = 11008] = "CLOSE_MINI_WINDOW";
|
|
14167
|
+
Web2NativeMessageEvent2[Web2NativeMessageEvent2["OPEN_WAKE_LOCK"] = 11009] = "OPEN_WAKE_LOCK";
|
|
14168
|
+
Web2NativeMessageEvent2[Web2NativeMessageEvent2["EXIT_WAKE_LOCK"] = 110010] = "EXIT_WAKE_LOCK";
|
|
14169
|
+
Web2NativeMessageEvent2[Web2NativeMessageEvent2["PUSH_WEB_DATA_INFO"] = 110011] = "PUSH_WEB_DATA_INFO";
|
|
14170
|
+
return Web2NativeMessageEvent2;
|
|
14171
|
+
})(Web2NativeMessageEvent || {});
|
|
14172
|
+
var Native2WebMessageEvent = /* @__PURE__ */ ((Native2WebMessageEvent2) => {
|
|
14173
|
+
Native2WebMessageEvent2[Native2WebMessageEvent2["ENTER_MINI_WINDOW"] = 21e3] = "ENTER_MINI_WINDOW";
|
|
14174
|
+
Native2WebMessageEvent2[Native2WebMessageEvent2["EXIT_MINI_WINDOW"] = 21001] = "EXIT_MINI_WINDOW";
|
|
14175
|
+
Native2WebMessageEvent2[Native2WebMessageEvent2["PAUSE"] = 21002] = "PAUSE";
|
|
14176
|
+
Native2WebMessageEvent2[Native2WebMessageEvent2["START_PLAY"] = 21003] = "START_PLAY";
|
|
14177
|
+
Native2WebMessageEvent2[Native2WebMessageEvent2["PLAY"] = 21004] = "PLAY";
|
|
14178
|
+
Native2WebMessageEvent2[Native2WebMessageEvent2["WEBVIEW_CONFIG"] = 21005] = "WEBVIEW_CONFIG";
|
|
14179
|
+
Native2WebMessageEvent2[Native2WebMessageEvent2["GET_WEB_DATA_INFO"] = 21006] = "GET_WEB_DATA_INFO";
|
|
14180
|
+
Native2WebMessageEvent2[Native2WebMessageEvent2["ENTER_FULLSCREEN"] = 21007] = "ENTER_FULLSCREEN";
|
|
14181
|
+
Native2WebMessageEvent2[Native2WebMessageEvent2["EXIT_FULLSCREEN"] = 21008] = "EXIT_FULLSCREEN";
|
|
14182
|
+
return Native2WebMessageEvent2;
|
|
14183
|
+
})(Native2WebMessageEvent || {});
|
|
14184
|
+
class ByteLiveJsBridge {
|
|
14185
|
+
constructor(data) {
|
|
14186
|
+
__publicField(this, "_emitter", new EventEmitter());
|
|
14187
|
+
__publicField(this, "isInIOS", false);
|
|
14188
|
+
__publicField(this, "jsBridgeName", "ByteLiveJsBridge");
|
|
14189
|
+
__publicField(this, "jsBridge", null);
|
|
14190
|
+
__publicField(this, "data", {
|
|
14191
|
+
room: {},
|
|
14192
|
+
player: {}
|
|
14193
|
+
});
|
|
14194
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
14195
|
+
__publicField(this, "nativeConfig", {});
|
|
14196
|
+
if (data == null ? void 0 : data.name) {
|
|
14197
|
+
this.jsBridgeName = data.name;
|
|
14198
|
+
}
|
|
14199
|
+
this.init();
|
|
14200
|
+
}
|
|
14201
|
+
init() {
|
|
14202
|
+
this.initVariables();
|
|
14203
|
+
if (!this.jsBridge) {
|
|
14204
|
+
this.mountGlobal();
|
|
14205
|
+
}
|
|
14206
|
+
this.callToNative(Web2NativeMessageEvent.INIT_FINISH, {});
|
|
14207
|
+
}
|
|
14208
|
+
getJsBridge() {
|
|
14209
|
+
const jsBridge = Reflect.get(window, this.jsBridgeName);
|
|
14210
|
+
if (jsBridge) {
|
|
14211
|
+
this.jsBridge = jsBridge;
|
|
14212
|
+
}
|
|
14213
|
+
return this.jsBridge;
|
|
14214
|
+
}
|
|
14215
|
+
setJsBridge(jsBridge) {
|
|
14216
|
+
Reflect.set(window, this.jsBridgeName, jsBridge);
|
|
14217
|
+
Reflect.set(window, "VeCloudJsBridge", jsBridge);
|
|
14218
|
+
console.log("设置到 window 上");
|
|
14219
|
+
this.jsBridge = jsBridge;
|
|
14220
|
+
}
|
|
14221
|
+
initVariables() {
|
|
14222
|
+
this.isInIOS = Boolean(sniffer.os.isIos);
|
|
14223
|
+
}
|
|
14224
|
+
mountGlobal() {
|
|
14225
|
+
const JsBridge = this.getJsBridge();
|
|
14226
|
+
console.log("从 window 上获取到的 jsBridge", JsBridge);
|
|
14227
|
+
if (JsBridge) {
|
|
14228
|
+
JsBridge.nativeCallBack = (data) => {
|
|
14229
|
+
console.log("收到native发来消息", data);
|
|
14230
|
+
this.handelEventCallBack(data);
|
|
14231
|
+
};
|
|
14232
|
+
this.jsBridge = JsBridge;
|
|
14233
|
+
} else {
|
|
14234
|
+
const JsBridge2 = {
|
|
14235
|
+
nativeCallBack: (data) => {
|
|
14236
|
+
console.log("收到native发来消息", data);
|
|
14237
|
+
this.handelEventCallBack(data);
|
|
14238
|
+
}
|
|
14239
|
+
// invokeNative: (data: IMessage) => {
|
|
14240
|
+
// console.log('发送给native', data);
|
|
14241
|
+
// },
|
|
14242
|
+
};
|
|
14243
|
+
this.setJsBridge(JsBridge2);
|
|
14244
|
+
}
|
|
14245
|
+
this.bindWebDataInfo();
|
|
14246
|
+
this.bindGetNativeConfig();
|
|
14247
|
+
}
|
|
14248
|
+
on(action, func) {
|
|
14249
|
+
this._emitter.on(action, func);
|
|
14250
|
+
}
|
|
14251
|
+
handelEventCallBack(data) {
|
|
14252
|
+
const { eventKey, info } = data ?? {};
|
|
14253
|
+
if (!eventKey || !Native2WebMessageEvent[eventKey]) {
|
|
14254
|
+
console.log("Native2Web未匹配到对应事件", eventKey);
|
|
14255
|
+
return;
|
|
14256
|
+
}
|
|
14257
|
+
this._emitter.emit(Native2WebMessageEvent[eventKey], info);
|
|
14258
|
+
}
|
|
14259
|
+
invokeNative(data) {
|
|
14260
|
+
var _a, _b, _c;
|
|
14261
|
+
console.log("发送给native", data);
|
|
14262
|
+
if (this.isInIOS) {
|
|
14263
|
+
(_c = (_b = (_a = window == null ? void 0 : window.webkit) == null ? void 0 : _a.messageHandlers) == null ? void 0 : _b.invokeNative) == null ? void 0 : _c.postMessage(data);
|
|
14264
|
+
}
|
|
14265
|
+
const JsBridge = this.jsBridge || Reflect.get(window, this.jsBridgeName);
|
|
14266
|
+
console.log(
|
|
14267
|
+
"JsBridge",
|
|
14268
|
+
this.jsBridge,
|
|
14269
|
+
Reflect.get(window, this.jsBridgeName)
|
|
14270
|
+
);
|
|
14271
|
+
if (JsBridge.invokeNative) {
|
|
14272
|
+
JsBridge.invokeNative(JSON.stringify(data));
|
|
14273
|
+
} else {
|
|
14274
|
+
console.log("未找到对应invokeNative方法");
|
|
14275
|
+
}
|
|
14276
|
+
}
|
|
14277
|
+
bindWebDataInfo() {
|
|
14278
|
+
this.on("GET_WEB_DATA_INFO", () => {
|
|
14279
|
+
this.callToNative(Web2NativeMessageEvent.PUSH_WEB_DATA_INFO, {
|
|
14280
|
+
...this.data
|
|
14281
|
+
});
|
|
14282
|
+
});
|
|
14283
|
+
}
|
|
14284
|
+
bindGetNativeConfig() {
|
|
14285
|
+
this.on("WEBVIEW_CONFIG", (data) => {
|
|
14286
|
+
this.nativeConfig = {
|
|
14287
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
14288
|
+
// @ts-ignore
|
|
14289
|
+
...this.nativeConfig,
|
|
14290
|
+
...data
|
|
14291
|
+
};
|
|
14292
|
+
});
|
|
14293
|
+
}
|
|
14294
|
+
callToNative(eventKey, info) {
|
|
14295
|
+
if (!eventKey || !Web2NativeMessageEvent[eventKey]) {
|
|
14296
|
+
console.log("Web2Native未匹配到对应事件", eventKey);
|
|
14297
|
+
return;
|
|
14298
|
+
}
|
|
14299
|
+
this.invokeNative({ eventKey, info });
|
|
14300
|
+
}
|
|
14301
|
+
callToNativeCreatePlayer(data) {
|
|
14302
|
+
this.data.room = {
|
|
14303
|
+
...this.data.room,
|
|
14304
|
+
isPortrait: data.isPortrait
|
|
14305
|
+
};
|
|
14306
|
+
this.callToNative(Web2NativeMessageEvent.CREATE_PLAYER, data);
|
|
14307
|
+
}
|
|
14308
|
+
callToNativeDestroyPlayer() {
|
|
14309
|
+
this.callToNative(Web2NativeMessageEvent.DESTROY_PLAYER, {});
|
|
14310
|
+
}
|
|
14311
|
+
callToNativeOpenFullScreen() {
|
|
14312
|
+
this.data.player = {
|
|
14313
|
+
...this.data.player,
|
|
14314
|
+
fullscreen: true
|
|
14315
|
+
};
|
|
14316
|
+
this.callToNative(Web2NativeMessageEvent.OPEN_FULLSCREEN, {});
|
|
14317
|
+
}
|
|
14318
|
+
callToNativeExitFullScreen() {
|
|
14319
|
+
this.data.player = {
|
|
14320
|
+
...this.data.player,
|
|
14321
|
+
fullscreen: false
|
|
14322
|
+
};
|
|
14323
|
+
this.callToNative(Web2NativeMessageEvent.EXIT_FULLSCREEN, {});
|
|
14324
|
+
}
|
|
14325
|
+
callToNativeLiveRoomStateChange(data) {
|
|
14326
|
+
this.data.room = {
|
|
14327
|
+
...this.data.room,
|
|
14328
|
+
status: data.status
|
|
14329
|
+
};
|
|
14330
|
+
this.callToNative(Web2NativeMessageEvent.LIVE_ROOM_STATE_CHANGE, data);
|
|
14331
|
+
}
|
|
14332
|
+
callToNativePlayerStateChange(data) {
|
|
14333
|
+
this.data.player = {
|
|
14334
|
+
...this.data.player,
|
|
14335
|
+
created: data.created,
|
|
14336
|
+
paused: data.paused
|
|
14337
|
+
};
|
|
14338
|
+
this.callToNative(Web2NativeMessageEvent.PLAYER_STATE_CHANGE, data);
|
|
14339
|
+
}
|
|
14340
|
+
callToNativeMediaLoadFinish(data) {
|
|
14341
|
+
this.data.player = {
|
|
14342
|
+
...this.data.player,
|
|
14343
|
+
videoWidth: data.videoWidth,
|
|
14344
|
+
videoHeight: data.videoHeight
|
|
14345
|
+
};
|
|
14346
|
+
this.callToNative(Web2NativeMessageEvent.MEDIA_LOAD_FINISH, data);
|
|
14347
|
+
}
|
|
14348
|
+
callToNativeOpenMiniWindow() {
|
|
14349
|
+
this.data.player = {
|
|
14350
|
+
...this.data.player,
|
|
14351
|
+
mini: true
|
|
14352
|
+
};
|
|
14353
|
+
this.callToNative(Web2NativeMessageEvent.OPEN_MINI_WINDOW, {});
|
|
14354
|
+
}
|
|
14355
|
+
callToNativeCloseMiniWindow() {
|
|
14356
|
+
this.data.player = {
|
|
14357
|
+
...this.data.player,
|
|
14358
|
+
mini: false
|
|
14359
|
+
};
|
|
14360
|
+
console.log("通知Native关闭小窗", /* @__PURE__ */ new Date());
|
|
14361
|
+
this.callToNative(Web2NativeMessageEvent.CLOSE_MINI_WINDOW, {});
|
|
14362
|
+
}
|
|
14363
|
+
callToNativeOpenWakeLock() {
|
|
14364
|
+
this.callToNative(Web2NativeMessageEvent.OPEN_WAKE_LOCK, {});
|
|
14365
|
+
}
|
|
14366
|
+
callToNativeExitWakeLock() {
|
|
14367
|
+
this.callToNative(Web2NativeMessageEvent.EXIT_WAKE_LOCK, {});
|
|
14368
|
+
}
|
|
14369
|
+
}
|
|
14370
|
+
let InnerJsBridge;
|
|
14371
|
+
const getJsbInstance = () => {
|
|
14372
|
+
if (InnerJsBridge)
|
|
14373
|
+
return InnerJsBridge;
|
|
14374
|
+
InnerJsBridge = new ByteLiveJsBridge();
|
|
14375
|
+
return InnerJsBridge;
|
|
14376
|
+
};
|
|
14377
|
+
var InnerJsBridge$1 = getJsbInstance();
|
|
14378
|
+
const bindPlayerEventsCallJSB = (player) => {
|
|
14379
|
+
const isPortrait = true;
|
|
14380
|
+
const isLive = true;
|
|
14381
|
+
if (!InnerJsBridge$1) {
|
|
14382
|
+
return;
|
|
14383
|
+
}
|
|
14384
|
+
if (!sniffer.os.isPc) {
|
|
14385
|
+
bindMiniWindowEvents(player);
|
|
14386
|
+
}
|
|
14387
|
+
InnerJsBridge$1.callToNativeCreatePlayer({
|
|
14388
|
+
isLive,
|
|
14389
|
+
isPortrait
|
|
14390
|
+
});
|
|
14391
|
+
InnerJsBridge$1.callToNativePlayerStateChange({
|
|
14392
|
+
created: true,
|
|
14393
|
+
paused: false
|
|
14394
|
+
});
|
|
14395
|
+
player.on(Events.PLAY, () => {
|
|
14396
|
+
InnerJsBridge$1 == null ? void 0 : InnerJsBridge$1.callToNativePlayerStateChange({
|
|
14397
|
+
created: true,
|
|
14398
|
+
paused: false
|
|
14399
|
+
});
|
|
14400
|
+
});
|
|
14401
|
+
player.on(Events.PAUSE, () => {
|
|
14402
|
+
InnerJsBridge$1 == null ? void 0 : InnerJsBridge$1.callToNativePlayerStateChange({
|
|
14403
|
+
created: true,
|
|
14404
|
+
paused: true
|
|
14405
|
+
});
|
|
14406
|
+
});
|
|
14407
|
+
player.on(Events.ERROR, () => {
|
|
14408
|
+
existMiniWindow();
|
|
14409
|
+
});
|
|
14410
|
+
player.on(Events.LOADED_DATA, () => {
|
|
14411
|
+
getVideoSizeWithRetry(player, isPortrait).then(
|
|
14412
|
+
({ videoWidth, videoHeight }) => {
|
|
14413
|
+
InnerJsBridge$1 == null ? void 0 : InnerJsBridge$1.callToNativeMediaLoadFinish({
|
|
14414
|
+
isPortrait: videoHeight > videoWidth,
|
|
14415
|
+
videoWidth,
|
|
14416
|
+
videoHeight
|
|
14417
|
+
});
|
|
14418
|
+
}
|
|
14419
|
+
);
|
|
14420
|
+
});
|
|
14421
|
+
};
|
|
14422
|
+
const destroyPlayerEventsCallJSB = () => {
|
|
14423
|
+
if (InnerJsBridge$1) {
|
|
14424
|
+
InnerJsBridge$1.callToNativeDestroyPlayer();
|
|
14425
|
+
InnerJsBridge$1.callToNativePlayerStateChange({
|
|
14426
|
+
created: false,
|
|
14427
|
+
paused: true
|
|
14428
|
+
});
|
|
14429
|
+
}
|
|
14430
|
+
existMiniWindow();
|
|
14431
|
+
};
|
|
14432
|
+
const bindMiniWindowEvents = (player) => {
|
|
14433
|
+
if (!InnerJsBridge$1) {
|
|
14434
|
+
return;
|
|
14435
|
+
}
|
|
14436
|
+
const handleMiniWindowChange = (state) => {
|
|
14437
|
+
if (!player || !player.root) {
|
|
14438
|
+
return;
|
|
14439
|
+
}
|
|
14440
|
+
if (state) {
|
|
14441
|
+
player.addClass("xgplayer-mobile-mini-window");
|
|
14442
|
+
} else {
|
|
14443
|
+
player.removeClass("xgplayer-mobile-mini-window");
|
|
14444
|
+
}
|
|
14445
|
+
};
|
|
14446
|
+
InnerJsBridge$1.on("WEBVIEW_CONFIG", (data) => {
|
|
14447
|
+
console.log("WEBVIEW_CONFIG", data);
|
|
14448
|
+
if (data == null ? void 0 : data.keepPlayWhenPageHide) {
|
|
14449
|
+
player.unRegisterPlugin("PageChangePlugin");
|
|
14450
|
+
}
|
|
14451
|
+
});
|
|
14452
|
+
InnerJsBridge$1.on("ENTER_MINI_WINDOW", () => {
|
|
14453
|
+
handleMiniWindowChange(true);
|
|
14454
|
+
});
|
|
14455
|
+
InnerJsBridge$1.on("EXIT_MINI_WINDOW", () => {
|
|
14456
|
+
console.log("切回小窗播放器处于暂停: ", player.paused, /* @__PURE__ */ new Date());
|
|
14457
|
+
if (player.paused) {
|
|
14458
|
+
player.play();
|
|
14459
|
+
}
|
|
14460
|
+
handleMiniWindowChange(false);
|
|
14461
|
+
});
|
|
14462
|
+
InnerJsBridge$1.on("PAUSE", () => {
|
|
14463
|
+
if (!player) {
|
|
14464
|
+
return;
|
|
14465
|
+
}
|
|
14466
|
+
player.pause();
|
|
14467
|
+
});
|
|
14468
|
+
InnerJsBridge$1.on("START_PLAY", () => {
|
|
14469
|
+
handleMiniWindowChange(false);
|
|
14470
|
+
if (!player) {
|
|
14471
|
+
return;
|
|
14472
|
+
}
|
|
14473
|
+
player.play();
|
|
14474
|
+
});
|
|
14475
|
+
InnerJsBridge$1.on("PLAY", () => {
|
|
14476
|
+
if (!player) {
|
|
14477
|
+
return;
|
|
14478
|
+
}
|
|
14479
|
+
player.play();
|
|
14480
|
+
});
|
|
14481
|
+
InnerJsBridge$1.on("ENTER_FULLSCREEN", () => {
|
|
14482
|
+
var _a;
|
|
14483
|
+
if (!(player == null ? void 0 : player.fullscreen)) {
|
|
14484
|
+
(_a = player.getPlugin("fullscreen")) == null ? void 0 : _a.toggleFullScreen();
|
|
14485
|
+
}
|
|
14486
|
+
});
|
|
14487
|
+
InnerJsBridge$1.on("EXIT_FULLSCREEN", () => {
|
|
14488
|
+
var _a;
|
|
14489
|
+
if (player == null ? void 0 : player.fullscreen) {
|
|
14490
|
+
(_a = player.getPlugin("fullscreen")) == null ? void 0 : _a.toggleFullScreen();
|
|
14491
|
+
}
|
|
14492
|
+
});
|
|
14493
|
+
};
|
|
14494
|
+
const existMiniWindow = () => {
|
|
14495
|
+
InnerJsBridge$1 && (InnerJsBridge$1 == null ? void 0 : InnerJsBridge$1.callToNativeCloseMiniWindow());
|
|
14496
|
+
};
|
|
14497
|
+
const getVideoSizeWithRetry = (player, isPortrait) => {
|
|
14498
|
+
const retryGetVideoSize = (retryCount = 0) => {
|
|
14499
|
+
return new Promise((resolve) => {
|
|
14500
|
+
let { videoWidth, videoHeight } = player.video;
|
|
14501
|
+
if (videoWidth > 0 && videoHeight > 0) {
|
|
14502
|
+
resolve({ videoWidth, videoHeight });
|
|
14503
|
+
return;
|
|
14504
|
+
}
|
|
14505
|
+
if (retryCount < 15) {
|
|
14506
|
+
setTimeout(() => {
|
|
14507
|
+
retryGetVideoSize(retryCount + 1).then(resolve);
|
|
14508
|
+
}, 500);
|
|
14509
|
+
return;
|
|
14510
|
+
}
|
|
14511
|
+
if (isPortrait) {
|
|
14512
|
+
videoWidth = 1080;
|
|
14513
|
+
videoHeight = 1920;
|
|
14514
|
+
} else {
|
|
14515
|
+
videoWidth = 1920;
|
|
14516
|
+
videoHeight = 1080;
|
|
14517
|
+
}
|
|
14518
|
+
resolve({ videoWidth, videoHeight });
|
|
14519
|
+
});
|
|
14520
|
+
};
|
|
14521
|
+
return retryGetVideoSize();
|
|
14522
|
+
};
|
|
14156
14523
|
const { POSITIONS: XGPosition } = Plugin;
|
|
14157
14524
|
const POSITIONS = {
|
|
14158
14525
|
...XGPosition,
|
|
@@ -14267,6 +14634,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14267
14634
|
this.emit(Events.PLAYER_CREATE_FINISH, this._player);
|
|
14268
14635
|
this._errorCallback = (err) => this._handleFallback(err);
|
|
14269
14636
|
this._player.on(ERROR, this._errorCallback);
|
|
14637
|
+
bindPlayerEventsCallJSB(this._player);
|
|
14270
14638
|
}
|
|
14271
14639
|
/** {zh}
|
|
14272
14640
|
* @brief 获取视频的就绪状态,其状态枚举值、枚举名称和说明如下:
|
|
@@ -14432,7 +14800,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14432
14800
|
* @brief Retrieve the player SDK version number.
|
|
14433
14801
|
*/
|
|
14434
14802
|
get playerVersion() {
|
|
14435
|
-
return "2.
|
|
14803
|
+
return "2.12.0-rc.0";
|
|
14436
14804
|
}
|
|
14437
14805
|
/** {zh}
|
|
14438
14806
|
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|
|
@@ -14937,6 +15305,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14937
15305
|
*/
|
|
14938
15306
|
destroy() {
|
|
14939
15307
|
var _a;
|
|
15308
|
+
destroyPlayerEventsCallJSB();
|
|
14940
15309
|
this._player.off(ERROR, this._errorCallback);
|
|
14941
15310
|
this._player.destroy();
|
|
14942
15311
|
(_a = this._customMedia) == null ? void 0 : _a.destroy();
|