New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

veplayer-mp-wechat

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

veplayer-mp-wechat - npm Package Compare versions

Comparing version

to
1.2.3-alpha.0

@@ -7,4 +7,3 @@ "use strict";

const index_1 = require("../tool/index");
const error_1 = require("../utils/error");
const index_2 = require("../enums/index");
const index_2 = require("../xgerror/index");
exports.default = Behavior({

@@ -15,5 +14,5 @@ properties: {

value: {},
observer(newVal, oldVal, _changedPath) {
observer(newVal, _changedPath) {
this.collector && this.collector.setConfig(newVal);
}
},
},

@@ -23,4 +22,4 @@ // 屏蔽日志配置验证,默认false,true的时候可以不配置日志

type: Boolean,
value: false
}
value: false,
},
},

@@ -33,3 +32,3 @@ data: {},

this.verifyCollector();
}
},
},

@@ -67,10 +66,10 @@ methods: {

const message = 'Collector for log not configured';
const error = new error_1.XGError(error_1.ErrorCategory.Collector, index_2.ErrorCodes.Collector_NOT_CONFIGURED, message);
error.severity = error_1.ErrorSeverity.INTERRUPTED;
const error = (0, index_2.XGError)(index_2.ErrorCategory.Collector, index_2.ErrorCodes.Collector_NOT_CONFIGURED, message);
error.severity = index_2.ErrorSeverity.INTERRUPTED;
this.setData({
error: error
error,
});
}
}
}
},
},
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* 这里维护所有原始video属性,使用这个Behavior的目的是为了区分开自定义组件属性减少混乱
*
* 原生Video组件属性说明:
* https://developers.weixin.qq.com/miniprogram/dev/component/video.html
*/
exports.default = Behavior({

@@ -8,5 +14,2 @@ properties: {

value: '',
observer(newVal, oldVal, _changedPath) {
// console.log('src:', newVal, oldVal);
}
},

@@ -20,3 +23,3 @@ /**

type: Number,
value: 0
value: 0,
},

@@ -26,27 +29,27 @@ danmuList: Array,

type: Boolean,
value: false
value: false,
},
enableDanmu: {
type: Boolean,
value: false
value: false,
},
autoplay: {
type: Boolean,
value: false
value: false,
},
loop: {
type: Boolean,
value: false
value: false,
},
muted: {
type: Boolean,
value: false
value: false,
},
initialTime: {
type: Number,
value: 0
value: 0,
},
pageGesture: {
type: Boolean,
value: false
value: false,
},

@@ -59,7 +62,7 @@ /**

type: Boolean,
value: true
value: true,
},
showFullscreenBtn: {
type: Boolean,
value: true
value: true,
},

@@ -71,3 +74,3 @@ /**

type: Boolean,
value: true
value: true,
},

@@ -78,7 +81,7 @@ /**

* bottom: 控制栏左侧
* bottom-center: 底部居中(扩展态)
* center-bottom: 底部居中(扩展态)
*/
playBtnPosition: {
type: String,
value: 'bottom'
value: 'bottom',
},

@@ -90,22 +93,22 @@ /**

type: Boolean,
value: true
value: true,
},
/**
* @description 【扩展属性】播放过程中是否显示播放按钮,如果为false, 则播放过程中一直不展示播放按钮
* @description 【扩展属性】播放按钮显示模式
*/
playBtnMode: {
type: String,
value: 'normal'
value: 'normal',
},
showMuteBtn: {
type: Boolean,
value: false
value: false,
},
enableProgressGesture: {
type: Boolean,
value: true
value: true,
},
objectFit: {
type: String,
value: 'contain'
value: 'contain',
},

@@ -120,23 +123,23 @@ /**

type: Boolean,
value: false
value: false,
},
autoPauseIfNavigate: {
type: Boolean,
value: true
value: true,
},
autoPauseIfOpenNative: {
type: Boolean,
value: true
value: true,
},
vslideGesture: {
type: Boolean,
value: false
value: false,
},
vslideGestureInFullscreen: {
type: Boolean,
value: true
value: true,
},
showBottomProgress: {
type: Boolean,
value: true
value: true,
},

@@ -147,27 +150,27 @@ adUnitId: String,

type: Boolean,
value: false
value: false,
},
pictureInPictureMode: {
type: String,
optionalTypes: [Array]
optionalTypes: [Array],
},
pictureInPictureShowProgress: {
type: Boolean,
value: false
value: false,
},
enableAutoRotation: {
type: Boolean,
value: false
value: false,
},
showScreenLockButton: {
type: Boolean,
value: false
value: false,
},
showSnapshotButton: {
type: Boolean,
value: false
value: false,
},
showBackgroundPlaybackButton: {
type: Boolean,
value: false
value: false,
},

@@ -177,31 +180,31 @@ backgroundPoster: String,

type: String,
value: 'no-referrer'
value: 'no-referrer',
},
isDrm: {
type: Boolean,
value: false
value: false,
},
isLive: {
type: Boolean,
value: false
value: false,
},
provisionUrl: {
type: String
type: String,
},
certificateUrl: {
type: String
type: String,
},
licenseUrl: {
type: String
type: String,
},
preferredPeakBitRate: {
type: Number
type: Number,
},
needLoading: {
type: Boolean,
value: true
}
value: true,
},
},
data: {},
methods: {}
methods: {},
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable object-shorthand */
/**

@@ -12,3 +13,3 @@ * @description 用于绑定或者解除绑定video相关事件

type: String,
value: ''
value: '',
},

@@ -18,4 +19,2 @@ },

'videoId': function (newVal, oldVal) {
const { videoId } = this.properties;
// console.log('!!!!observers videoId', newVal, oldVal, videoId, videoId === newVal)
if (newVal === oldVal || !newVal) {

@@ -26,3 +25,3 @@ return;

this.addMediaEvents();
}
},
},

@@ -46,3 +45,3 @@ methods: {

key: index_1.MediaEvents[key],
funName: funName
funName: funName,
});

@@ -68,4 +67,4 @@ });

this.media = null;
}
}
},
},
});

@@ -29,2 +29,3 @@ "use strict";

ExtendsEvents["PROGRESS_DRAG_END"] = "progressdragend";
ExtendsEvents["ACTIVE"] = "active";
})(ExtendsEvents = exports.ExtendsEvents || (exports.ExtendsEvents = {}));

@@ -17,4 +17,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultInteractiveConfig = exports.PLAY_BTN_MODE = exports.PLAY_BTN_POSITION = exports.ControlsStates = exports.ControlsStateClass = exports.InteractStates = exports.PlayerModes = void 0;
__exportStar(require("./errorCode"), exports);
exports.DefaultInteractiveConfig = exports.PLAY_BTN_MODE = exports.PLAY_BTN_POSITION = exports.ControlsStates = exports.ControlsStateClass = exports.InteractStates = exports.VERSION = exports.PKG = exports.PlayerModes = void 0;
/* eslint-disable @typescript-eslint/naming-convention */
__exportStar(require("./events"), exports);

@@ -27,2 +27,4 @@ var PlayerModes;

})(PlayerModes = exports.PlayerModes || (exports.PlayerModes = {}));
exports.PKG = 'wechat';
exports.VERSION = '1.2.3-alpha.0';
/**

@@ -46,8 +48,13 @@ * 控制栏状态枚举

})(ControlsStateClass = exports.ControlsStateClass || (exports.ControlsStateClass = {}));
/**
* @description 控制栏枚举值
*/
var ControlsStates;
(function (ControlsStates) {
ControlsStates["NATIVE"] = "native";
ControlsStates["CUSTOM"] = "custom";
ControlsStates["FOCUS"] = "focus";
ControlsStates["HIDDEN"] = "hidden";
ControlsStates["CUSTOM"] = "custom";
ControlsStates["BLUR"] = "blur";
ControlsStates["IMMERSE"] = "immerse";
})(ControlsStates = exports.ControlsStates || (exports.ControlsStates = {}));

@@ -65,2 +72,3 @@ /**

* 播放按钮位置枚举
* PLAY_BTN_MODE
*/

@@ -72,2 +80,3 @@ var PLAY_BTN_MODE;

})(PLAY_BTN_MODE = exports.PLAY_BTN_MODE || (exports.PLAY_BTN_MODE = {}));
// eslint-disable-next-line @typescript-eslint/naming-convention
exports.DefaultInteractiveConfig = {

@@ -74,0 +83,0 @@ immersive: false,

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable no-magic-numbers */
/* eslint-disable @typescript-eslint/no-magic-numbers */
/* eslint-disable max-len */
/* eslint-disable object-shorthand */
/* eslint-disable @typescript-eslint/naming-convention */
const eventemitter3_1 = require("eventemitter3");
const xgplayer_service_miniprogram_1 = require("xgplayer-service-miniprogram");
const videoBehavior_1 = require("./behaviors/videoBehavior");
const collectorBehavior_1 = require("./behaviors/collectorBehavior");
const interact_behavior_1 = require("./behaviors/interact_behavior");
const index_1 = require("./enums/index");
const error_1 = require("./utils/error");
const index_2 = require("./utils/index");
const index_3 = require("./tool/index");
(0, index_2.XgComponent)({
behaviors: ['wx://component-export', videoBehavior_1.default, collectorBehavior_1.default],
const index_2 = require("./xgerror/index");
const index_3 = require("./utils/index");
const index_4 = require("./request/index");
const index_5 = require("./tool/index");
(0, index_3.XgComponent)({
behaviors: ['wx://component-export', videoBehavior_1.default, collectorBehavior_1.default, interact_behavior_1.default],
properties: {
controls: {
type: String || Boolean,
optionalTypes: [Boolean],
value: 'custom',
observer(newVal, oldVal, _changedPath) {
const { customControls, videoId, interactState } = this.data;
console.log(`>>>observer controls old:${oldVal} new:${newVal}`);
if (!customControls) {
this.setData({
customControls: newVal === "native" /* ControlsStates.NATIVE */ ? false : true
});
}
if (!videoId) {
return;
}
this.switchOutControls(newVal, false);
}
},
mode: {
type: String,
value: "portrait" /* PlayerModes.PORTRAIT */
value: "portrait" /* PlayerModes.PORTRAIT */,
},
componentId: {
type: String,
value: ''
value: '',
},
playAuthToken: {
type: String,
value: ''
value: '',
},
playDomain: {
type: String,
value: 'https://vod.volcengineapi.com' // 默认火山引擎点播openapi域名
value: 'https://vod.volcengineapi.com', // 默认火山引擎点播openapi域名
},

@@ -51,21 +39,34 @@ definitionUrls: {

value: [],
observer(newVal, oldVal, _changedPath) {
observer(newVal, _changedPath) {
// console.log('definitionUrls:', newVal, oldVal);
this.setData({ definitionUrls: newVal });
}
},
},
autoBlurTime: {
/**
* @description 是否允许空资源起播
* 如果传入true, 则当src和playAuthToken为空的时候不触发播放错误,只显示loading,等待用户更新src或者playAuthToken
*/
allowNullSource: {
type: Boolean,
value: true,
},
veDebugger: {
type: Number,
value: 10000
value: 0,
},
interactiveConfig: {
type: Object,
value: index_1.DefaultInteractiveConfig
loadingText: {
type: Number,
value: '正在加载...',
},
// 当前实例是否是激活状态
isActive: {
type: Boolean,
value: true,
},
},
data: {
version: '1.2.1-alpha.1',
videoId: '',
videoProps: {},
videoSourceUrl: undefined,
currentSrc: '',
classNames: '',

@@ -89,18 +90,18 @@ error: null,

definitionChangeTime: null,
showLoading: true,
loading: true,
isLoadingData: true,
showPoster: false,
playbackDefinition: undefined,
playbackDefinitionList: undefined,
isFocus: true,
interactState: "blur" /* InteractStates.BLUR */,
autoSwitch: false,
customControls: false // 控制栏初始状态
// isFocus: true,
customControls: false,
isHidden: false, // 是否隐藏video组件
},
observers: {
error: function (err) {
if (err instanceof error_1.XGError && err.severity === error_1.ErrorSeverity.INTERRUPTED) {
// console.log('error:', err);
this._emitEvt(index_1.MediaEvents.ERROR, err);
}
},
// error: function (err) {
// if (err?.severity === ErrorSeverity.INTERRUPTED) {
// this.triggerEvent(MediaEvents.ERROR, err)
// this.triggerCollector(MediaEvents.ERROR, err)
// }
// },
seeking: function (flag) {

@@ -115,5 +116,21 @@ this._emitEvt(flag ? index_1.MediaEvents.SEEKING : index_1.MediaEvents.SEEKCOMPLETE);

},
'isActive': function isActive() {
const { isActive } = this.data;
index_3.VE_DEBUGGER.log('isActive change', isActive);
this.triggerCollector(index_1.ExtendsEvents.ACTIVE, { isActive });
},
'currentSrc': function () {
const { currentSrc, src } = this.data;
this.setData({
error: null,
isLoadingData: false,
isHidden: false,
});
this.updateCollector({
src: currentSrc || src,
});
},
'src,definitionList,playAuthToken,playDomain': function () {
const { src, definitionList, playAuthToken, playDomain } = this.data;
// console.log('>>>>observers', src, definitionList, playAuthToken, playDomain)
const { src, definitionList, playAuthToken, playDomain, isLoadingData } = this.data;
index_3.VE_DEBUGGER.log('sourceChange', src, playAuthToken, isLoadingData);
this.triggerCollector('break');

@@ -125,53 +142,37 @@ this.updateCollector(this.data);

this.setData({
definitionList: definitionList
definitionList: definitionList,
});
}
this.setData({
currentSrc: src,
isHidden: false,
isLoadingData: false,
});
}
else if (playAuthToken) {
// console.log('ServiceRequest: ', playDomain, playAuthToken);
(0, xgplayer_service_miniprogram_1.url)(playAuthToken, playDomain || undefined).then((res) => {
const data = (res === null || res === void 0 ? void 0 : res.Data) || res || {};
if (Array.isArray(data.PlayInfoList)) {
const defaultDef = data.PlayInfoList[0];
const qualityList = data.PlayInfoList.sort((a, b) => b.Bitrate - a.Bitrate).map((item) => {
const def = {
text: item.Definition,
url: item.MainPlayUrl,
quality: item.Bitrate
};
return def;
});
this.setData({
isLoadingData: true,
});
index_3.VE_DEBUGGER.log('serviceRequest start');
(0, index_4.serviceRequest)(playAuthToken, playDomain || undefined)
.then(data => {
index_3.VE_DEBUGGER.log('serviceRequest res', data);
if (data.error) {
this.setData({
videoSourceUrl: defaultDef.MainPlayUrl
isLoadingData: false,
error: data.error,
isHidden: false,
});
if (qualityList.length > 0) {
this.setData({
playbackDefinition: defaultDef.Bitrate,
playbackDefinitionList: qualityList
});
}
this._emitError({}, data.error);
}
else {
this.setData({
error: new error_1.XGError(error_1.ErrorCategory.SERVICE, index_1.ErrorCodes.SERVICE_PLAYINFOLIST_EMPTY, 'Service Error')
isLoadingData: false,
currentSrc: data.url,
isHidden: false,
});
}
}).catch((err) => {
this.setData({
error: new error_1.XGError(error_1.ErrorCategory.SERVICE, index_1.ErrorCodes.SERVICE_UNKNOWN, 'Service Error')
});
});
}
},
'interactState': function () {
const { interactState, autoSwitch, controls } = this.data;
const data = {
show: interactState !== "blur" /* InteractStates.BLUR */,
state: interactState,
isAuto: autoSwitch,
controls
};
this.media && this.media.emit(index_1.MediaEvents.CONTROLSTOGGLE, data);
this.triggerEvent(index_1.MediaEvents.CONTROLSTOGGLE, data);
}
},

@@ -181,13 +182,13 @@ lifetimes: {

var _a;
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;
const { videoId, videoProps, isFullScreen, loadedMeta, toggleCtrlOverLayer, ended } = this.data;
const { controls } = this.properties;
this.__deviceInfo = wx.getDeviceInfo();
const { videoId, videoProps, isFullScreen } = this.data;
// const { controls } = this.properties
index_3.VE_DEBUGGER.log('MAIN', 'attached');
let _videoId = videoId || this.properties.componentId;
if (!_videoId) {
_videoId = (0, index_2.generateUppercaseUid)();
_videoId = (0, index_3.generateUppercaseUid)();
}
this.setData({
videoId: _videoId,
customControls: controls !== 'native' ? true : false
});

@@ -198,5 +199,5 @@ const videoCtx = wx.createVideoContext(_videoId, this);

// use Set to filter duplicate string item in Array
...new Set([isFullScreen ? ' xg-video-fullscreen' : '', ...propsClassNames])
...new Set([isFullScreen ? ' xg-video-fullscreen' : '', ...propsClassNames]),
].filter((item) => !!item);
const showCtrlOverlay = (loadedMeta && toggleCtrlOverLayer) || ended;
// const showCtrlOverlay = (loadedMeta && toggleCtrlOverLayer) || ended
const videoProxyCtx = new Proxy(videoCtx, {

@@ -207,15 +208,16 @@ get(target, prop, receiver) {

self.setData({
seeking: true
seeking: true,
});
}
return Reflect.get(target, prop, receiver);
}
},
});
if (Object.isExtensible(videoProxyCtx)) {
// eslint-disable-next-line @typescript-eslint/dot-notation
!videoProxyCtx['on'] && Object.assign(videoProxyCtx, new eventemitter3_1.EventEmitter(), eventemitter3_1.EventEmitter.prototype);
this.media = videoProxyCtx;
}
index_3.default.setMedia(_videoId, this.media);
index_5.default.setMedia(_videoId, this.media);
this.setData({
classNames: classNames.join(' ')
classNames: classNames.join(' '),
});

@@ -227,16 +229,13 @@ },

ready() {
this._fTimer = null;
this._pTimer = null;
this._touch = {
moving: false,
count: 0,
startY: -1,
startX: -1
};
if (!this.properties.interactiveConfig) {
this.properties.interactiveConfig = index_1.DefaultInteractiveConfig;
const { src, allowNullSource, playAuthToken, veDebugger } = this.properties;
const { currentSrc } = this.data;
index_3.VE_DEBUGGER.debugger = veDebugger;
this.updateStatusOfShowLoading();
// !!controls && this.focusPlayer()
index_3.VE_DEBUGGER.log('ready', !!this.media, `isHidden:${allowNullSource && !src && !currentSrc}`);
if (!src && !currentSrc && (playAuthToken || allowNullSource)) {
this.setData({
isHidden: true,
});
}
this.updateStatusOfShowLoading();
this.initControls();
console.log((0, index_2.getSystemInfoSync)());
},

@@ -251,6 +250,5 @@ /**

}
index_3.default.removeMedia(this.data.videoId);
index_5.default.removeMedia(this.data.videoId);
this.triggerCollector('detached', {});
this.destroyCollector();
// clearTimeout(this._fTimer)
},

@@ -261,9 +259,11 @@ /**

error(e) {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const message = (e === null || e === void 0 ? void 0 : e.stack) || (e === null || e === void 0 ? void 0 : e.message) || '';
const error = new error_1.XGError(error_1.ErrorCategory.UNKNOWN, index_1.ErrorCodes.Component_LIFETIME_ERROR, message);
error.severity = error_1.ErrorSeverity.IGNORABLE;
const error = (0, index_2.XGError)(index_2.ErrorCategory.UNKNOWN, index_2.ErrorCodes.Component_LIFETIME_ERROR, message);
error.severity = index_2.ErrorSeverity.IGNORABLE;
this._emitError(e, error);
this.setData({
error: error
error: error,
});
}
},
},

@@ -274,91 +274,18 @@ methods: {

},
initControls() {
const { customControls, firstPlay, videoId, interactState } = this.data;
if (!customControls) {
return;
_emitError(e, err) {
index_3.VE_DEBUGGER.log('_emitError', err, e);
if ((err === null || err === void 0 ? void 0 : err.severity) === index_2.ErrorSeverity.INTERRUPTED) {
const evData = Object.assign(Object.assign({ e, data: this.data }, e.detail), err);
this.triggerEvent(index_1.MediaEvents.ERROR, evData);
this.triggerCollector(index_1.MediaEvents.ERROR, evData);
}
const { controlsState, autoplay, controls } = this.properties;
let ret = this.getStateByControls(controls);
console.log(`>>>initControls ${videoId}`, `controls:${controls} interactState:${interactState} next:${ret.state} auto:${ret.auto}`);
// this.switchControls(ret.state, ret.auto, true)
this.switchOutControls(controls, true);
},
switchOutControls(newVal, isAuto = false) {
if (newVal === "native" /* ControlsStates.NATIVE */) {
return;
}
const _isBlur = newVal === "blur" /* ControlsStates.BLUR */;
const _state = !newVal || newVal === "hidden" /* ControlsStates.HIDDEN */ || newVal === "blur" /* ControlsStates.BLUR */ ? "blur" /* InteractStates.BLUR */ : "focus" /* InteractStates.FOCUS */;
const { focusDelay } = this.properties.interactiveConfig;
if (this._pTimer) {
clearTimeout(this._pTimer);
this._pTimer = null;
}
if (this._fTimer) {
clearTimeout(this._fTimer);
this._fTimer = null;
}
console.log(`>>>switchOutControls controls:${newVal} state:${_state} isAuto:${_isBlur}`);
this.switchControls(_state, _state === "focus" /* InteractStates.FOCUS */, isAuto);
if (focusDelay && _isBlur) {
this._pTimer = setTimeout(() => {
this.switchControls("focus" /* InteractStates.FOCUS */, true, true);
}, focusDelay);
}
},
/**
*
* @param {string} state 切换到的状态
* @param {boolean} needAuto 切换之后是否自动切换到下一个状态
* @param {boolean} autoSwitch 当前操作是否是自动的
* @returns
*/
switchControls(state, needAuto = true, autoSwitch = false) {
const { interactState, customControls, videoId } = this.data;
if (!customControls || !state) {
return;
}
const { delay, immersive, focusDelay } = this.properties.interactiveConfig || {};
// console.log(`>>>switchControls ${videoId} needAuto:${needAuto} state>from:${interactState} to:${state}, immersive:${immersive}`)
if (this._fTimer) {
clearTimeout(this._fTimer);
this._fTimer = null;
}
let _nextState = '';
let _delay = delay;
let _nextAuto = false;
if (state === "focus" /* InteractStates.FOCUS */) {
_nextState = immersive ? "immerse" /* InteractStates.IMMERSE */ : "blur" /* InteractStates.BLUR */;
_delay = delay;
_nextAuto = false;
}
else if (state === "blur" /* InteractStates.BLUR */) {
_nextState = "focus" /* InteractStates.FOCUS */;
_delay = focusDelay;
_nextAuto = true;
}
if (needAuto && _delay > 0) {
this._fTimer = setTimeout(() => {
console.log(`>>>AutoSwitchControls ${videoId} state:${_nextState} auto:${_nextAuto}`);
this.switchControls(_nextState, _nextAuto, true);
clearTimeout(this._fTimer);
this._fTimer = null;
}, _delay);
// this._fTimer = setTimeout(this.timeoutFun.bind(this), _delay, _nextState, _nextAuto)
}
// console.log(`>>>switchControls_after ${videoId} _delay: ${_delay} needAuto:${needAuto} interactState:${interactState} state:${state} _nextState:${_nextState} ${needAuto && _delay > 0 } this._fTimer:${this._fTimer}`)
state !== interactState && this.setData({
interactState: state,
isFocus: state !== "blur" /* InteractStates.BLUR */,
autoSwitch
});
},
/**
* @private
*/
_emitEvt(evName, e) {
const evData = { e, data: this.data };
const evData = Object.assign({ e, data: this.data }, e.detail);
// Fire event to context
this.media.emit(evName, evData);
evName !== index_1.MediaEvents.ERROR && this.triggerCollector(evName, e);
this.triggerCollector(evName, e);
// The event is a component prop event for 'bind***'

@@ -368,15 +295,15 @@ this.triggerEvent(evName, evData);

onError(e) {
let { errMsg } = e.detail;
let errCode;
if (/Format error$/gi.test(errMsg)) {
errCode = index_1.ErrorCodes.MEDIA_ERR_FORMAT_ERROR;
errMsg = '格式错误';
const { errMsg } = e.detail;
const { isLoadingData, currentSrc, allowNullSource } = this.data;
index_3.VE_DEBUGGER.log('onError', `isLoadingData:${isLoadingData} currentSrc:${!!currentSrc} allowNullSource:${allowNullSource}`);
if (!currentSrc && (allowNullSource || isLoadingData)) {
console.warn('The is unavailable [src] or [playAutoToken] for playback, please check~~');
return;
}
else {
errCode = index_1.ErrorCodes.MEDIA_ERR_UNKNOWN;
errMsg = '其他错误';
}
this.triggerCollector(index_1.MediaEvents.ERROR, e, { errCode, errMsg });
const errCode = e.detail.errCode || 0;
const error = (0, index_2.XGError)(index_2.ErrorCategory.MEDIA, errCode, errMsg, e.detail);
console.log('>>[weapp_Index]onError', e.detail, e);
this._emitError(e, error);
this.setData({
error: new error_1.XGError(error_1.ErrorCategory.MEDIA, errCode, errMsg)
error,
});

@@ -386,11 +313,10 @@ },

const { definitionChangePoint } = this.data;
const { duration, height, width } = e.detail;
// console.log('onLoadedMetadata', e.detail)
const { duration } = e.detail;
this.setData({
loadedMeta: true,
duration: duration
duration: duration,
});
if (definitionChangePoint) {
this.setData({
definitionChangePoint: undefined
definitionChangePoint: undefined,
});

@@ -402,6 +328,7 @@ this.media.seek(definitionChangePoint);

onPlay(e) {
const { firstPlay, interactState } = this.data;
const { firstPlay } = this.data;
const obj = {
paused: false,
ended: false,
error: null,
};

@@ -413,16 +340,10 @@ if (!firstPlay) {

this._emitEvt(index_1.MediaEvents.PLAY, e);
const { focusDelay } = this.properties.interactiveConfig;
/**
* 1. 当前controls处于整体隐藏阶段
* 2. 当前controls处于blur,且延迟自动focus阶段
* 以上两重情况不触发focus
*/
if (!this.isControlsShow() || (interactState === "blur" /* InteractStates.BLUR */ && focusDelay > 0)) {
return;
}
// 之前是focus状态,要切换到可自动隐藏的Focus
console.log('>>>switchControls onplay', "focus" /* InteractStates.FOCUS */, true, false);
this.switchControls("focus" /* InteractStates.FOCUS */, true, false);
// !!controls && this.focusPlayer()
this.switchControlsOnPlay();
},
onPause(e) {
// const { isFocus, videoId } = this.data;
// const { controls } = this.properties
// !!controls && this.focusPlayer(false)
this.switchControlsOnPause();
this.setData({

@@ -432,6 +353,2 @@ paused: true,

this._emitEvt(index_1.MediaEvents.PAUSE, e);
if (this.isControlsShow()) {
this.switchControls("focus" /* InteractStates.FOCUS */, false, false);
console.log('>>>switchControls onpause', "focus" /* InteractStates.FOCUS */, true, false);
}
},

@@ -444,3 +361,3 @@ onTimeupdate(e) {

duration: duration || 0,
playPercent: duration > 0 ? Math.floor((currentTime / duration) * 100) : 0
playPercent: duration > 0 ? Math.floor((currentTime / duration) * 100) : 0,
};

@@ -451,14 +368,8 @@ if (seeking) {

}
/**
* @description 兼容ios和android在暂停之后seek时事件触发不一致导致的问题
*/
// if (this.__deviceInfo.platform !== 'ios' && !seeking && paused) {
// data.paused = false
// }
this.setData(data);
this._emitEvt(index_1.MediaEvents.TIMEUPDATE, e);
},
onSeeked(e) {
onSeeked() {
this.setData({
seeking: false
seeking: false,
});

@@ -472,3 +383,3 @@ // 挪到状态变化内进行事件监听

ended: true,
paused: true
paused: true,
};

@@ -485,3 +396,3 @@ if (seeking) {

buffered: buffered,
bufferedTime: buffered * this.data.duration / 100
bufferedTime: buffered * this.data.duration / 100,
});

@@ -491,5 +402,5 @@ this._emitEvt(index_1.MediaEvents.PROGRESS, e);

onFullscreenChange(e) {
const { fullScreen, direction } = e.detail;
const { fullScreen } = e.detail;
this.setData({
isFullScreen: fullScreen
isFullScreen: fullScreen,
});

@@ -501,9 +412,11 @@ this._emitEvt(index_1.MediaEvents.FULLSCREENCHANGE, e);

},
/**
* @description 原生控制栏状态切换回调
*/
onControlsToggle(e) {
const { customControls } = this.data;
// 非自定义控制栏,不做处理
// 自定义控制栏不在此处做响应
if (customControls) {
return;
}
this.media.emit(index_1.MediaEvents.CONTROLSTOGGLE, e.detail);
this.triggerEvent(index_1.MediaEvents.CONTROLSTOGGLE, e.detail);

@@ -518,114 +431,8 @@ },

onCompErrorRetry() {
//
},
/**
* @description 内置用户行为,统一下发信息
* @param e
*/
handleUserAction(e) {
const { props } = e.detail;
if (props === 'paused') {
this.switchControls("focus" /* InteractStates.FOCUS */, true, false);
}
this.media.emit(index_1.ExtendsEvents.USER_ACTION, e.detail);
this.triggerEvent(index_1.ExtendsEvents.USER_ACTION, e.detail);
},
onTouchStart(e) {
},
onTouchMove(e) {
const { _touch } = this;
const _t = (0, index_2.getTouch)(e);
const { enableProgressGesture } = this.properties;
if (_touch.count === 0) {
_touch.startX = _t.clientX;
_touch.startY = _t.clientY;
}
_touch.count++;
_touch.endX = _t.clientX;
_touch.endY = _t.clientY;
if (this.data.firstPlay && _touch.count > 5 && !_touch.moving) {
const { startX, startY, endX, endY } = _touch;
const isSeeking = endY - startY === 0 || Math.abs((endX - startX) / (endY - startY)) > 1;
if (isSeeking) {
// 手势在播放器区域滑动,说明在做seek,聚焦控制栏状态
_touch.moving = isSeeking;
enableProgressGesture && this.switchControls("focus" /* InteractStates.FOCUS */, false, false);
}
}
},
onTouchEnd(e) {
const { _touch } = this;
const { enableProgressGesture } = this.properties;
console.log(`onTouchEnd: moving:${_touch.moving}`);
if (_touch.moving) {
// 拖动结束,恢复正常状态
enableProgressGesture && this.switchControls("focus" /* InteractStates.FOCUS */, true, false);
}
this._touch = {
moving: false,
count: 0,
startY: -1,
startX: -1,
endX: -1,
endY: -1,
};
},
onTap(e) {
const { mode, loadedMeta, paused, isFocus, ended, videoId, customControls, interactState, controls } = this.data;
const { enablePlayGesture, interactiveConfig } = this.properties;
if (!customControls) {
return;
}
if (enablePlayGesture && mode === "portrait" /* PlayerModes.PORTRAIT */) {
if (loadedMeta) {
if (paused || ended) {
this.media.play();
}
else {
this.media.pause();
}
}
}
// 由外部交互的的时候关闭内部交互
if (controls !== "custom" /* ControlsStates.CUSTOM */ || !enablePlayGesture) {
return;
}
let nextState = '';
let _auto = false;
if (!interactiveConfig.immersive) {
if (interactState === "focus" /* InteractStates.FOCUS */) {
nextState = "blur" /* InteractStates.BLUR */;
}
else {
nextState = "focus" /* InteractStates.FOCUS */;
_auto = true;
}
}
else {
if (interactState === "focus" /* InteractStates.FOCUS */ && interactiveConfig.clickHide) {
nextState = "blur" /* InteractStates.BLUR */;
_auto = true;
}
else {
nextState = "focus" /* InteractStates.FOCUS */;
_auto = true;
}
}
console.log(`>>>switchControls onTap ${videoId} controls:${controls} interactState:${interactState} nextState:${nextState}`);
nextState && this.switchControls(nextState, _auto, false);
},
onProgressDragStart(e) {
this.handleUserAction(e);
// 拖动进度条的时候,整体控制栏切换至聚焦状态
this.switchControls("focus" /* InteractStates.FOCUS */, false, false);
},
onProgressDragEnd(e) {
// 进度条拖动结束,整体控制栏切换至聚焦且可自动隐藏状态
this.handleUserAction(e);
const _autoHide = this.data.paused ? false : true;
this.switchControls("focus" /* InteractStates.FOCUS */, _autoHide, false);
},
updateStatusOfShowLoading(e) {
updateStatusOfShowLoading() {
const { loadedMeta, seeking, paused } = this.data;
this.setData({
showLoading: !loadedMeta || (seeking && !paused)
loading: !loadedMeta || (seeking && !paused),
});

@@ -636,24 +443,11 @@ },

this.setData({
showPoster: poster && !error && !autoplay && !firstPlay
showPoster: poster && !error && !autoplay && !firstPlay,
});
},
updateLoggerParams() { },
isControlsShow() {
const { controls } = this.properties;
return controls && controls !== "native" /* ControlsStates.NATIVE */ && controls !== "hidden" /* ControlsStates.HIDDEN */;
updateLoggerParams() {
//
},
getStateByControls(val) {
const auto = !(!val || val === "hidden" /* ControlsStates.HIDDEN */);
const state = !val || val === "hidden" /* ControlsStates.HIDDEN */ || val === "blur" /* ControlsStates.BLUR */ ? "blur" /* InteractStates.BLUR */ : "focus" /* InteractStates.FOCUS */;
return {
auto,
state
};
},
checkStateMatch() {
const { controls, interactState } = this.data;
// if (controls === ControlsStates.BLUR && interactState === )
}
},
export() {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const component = this;

@@ -666,8 +460,10 @@ return {

component.setData({
definitionUrls: urlArr
definitionUrls: urlArr,
});
},
updateLoggerParams() { }
updateLoggerParams() {
//
},
};
}
},
});

@@ -1,1 +0,1 @@

module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=22)}([function(t,e,n){"use strict";var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,e,n){"use strict";var r=n(12)("wks"),o=n(13),i=n(0).Symbol,u="function"==typeof i;(t.exports=function(t){return r[t]||(r[t]=u&&i[t]||(u?i:o)("Symbol."+t))}).store=r},function(t,e,n){"use strict";var r=t.exports={version:"2.6.11"};"number"==typeof __e&&(__e=r)},function(t,e,n){"use strict";var r=n(4);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(t){return"object"===(void 0===t?"undefined":r(t))?null!==t:"function"==typeof t}},function(t,e,n){"use strict";var r=n(6);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){"use strict";t.exports=!n(15)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(t,e,n){"use strict";var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,e,n){"use strict";var r=n(3),o=n(26),i=n(27),u=Object.defineProperty;e.f=n(7)?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return u(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){"use strict";t.exports=!1},function(t,e,n){"use strict";var r=n(8),o=n(1)("toStringTag"),i="Arguments"==r(function(){return arguments}());t.exports=function(t){var e,n,u;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),o))?n:i?r(e):"Object"==(u=r(e))&&"function"==typeof e.callee?"Arguments":u}},function(t,e,n){"use strict";var r=n(2),o=n(0),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(10)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e,n){"use strict";var r=0,o=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+o).toString(36))}},function(t,e,n){"use strict";var r=n(9),o=n(28);t.exports=n(7)?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){"use strict";t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){"use strict";var r=n(4),o=n(0).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e,n){"use strict";var r=n(0),o=n(14),i=n(18),u=n(13)("src"),c=n(29),s=(""+c).split("toString");n(2).inspectSource=function(t){return c.call(t)},(t.exports=function(t,e,n,c){var f="function"==typeof n;f&&(i(n,"name")||o(n,"name",e)),t[e]!==n&&(f&&(i(n,u)||o(n,u,t[e]?""+t[e]:s.join(String(e)))),t===r?t[e]=n:c?t[e]?t[e]=n:o(t,e,n):(delete t[e],o(t,e,n)))})(Function.prototype,"toString",(function(){return"function"==typeof this&&this[u]||c.call(this)}))},function(t,e,n){"use strict";var r={}.hasOwnProperty;t.exports=function(t,e){return r.call(t,e)}},function(t,e,n){"use strict";t.exports={}},function(t,e,n){"use strict";var r,o,i,u=n(5),c=n(38),s=n(39),f=n(16),a=n(0),l=a.process,d=a.setImmediate,p=a.clearImmediate,v=a.MessageChannel,h=a.Dispatch,y=0,m={},_=function(){var t=+this;if(m.hasOwnProperty(t)){var e=m[t];delete m[t],e()}},x=function(t){_.call(t.data)};d&&p||(d=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return m[++y]=function(){c("function"==typeof t?t:Function(t),e)},r(y),y},p=function(t){delete m[t]},"process"==n(8)(l)?r=function(t){l.nextTick(u(_,t,1))}:h&&h.now?r=function(t){h.now(u(_,t,1))}:v?(i=(o=new v).port2,o.port1.onmessage=x,r=u(i.postMessage,i,1)):a.addEventListener&&"function"==typeof postMessage&&!a.importScripts?(r=function(t){a.postMessage(t+"","*")},a.addEventListener("message",x,!1)):r="onreadystatechange"in f("script")?function(t){s.appendChild(f("script")).onreadystatechange=function(){s.removeChild(this),_.call(t)}}:function(t){setTimeout(u(_,t,1),0)}),t.exports={set:d,clear:p}},function(t,e,n){"use strict";var r=n(6);function o(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r})),this.resolve=r(e),this.reject=r(n)}t.exports.f=function(t){return new o(t)}},function(t,e,n){t.exports=n(23)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n(24);var r=i(n(48)),o=i(n(50));function i(t){return t&&t.__esModule?t:{default:t}}e.default={url:r.default,uid:!(0,o.default)()&&document&&document.cookie&&/tt_webid=(\d+)/gi.test(document.cookie)?RegExp.$1:""},t.exports=e.default},function(t,e,n){"use strict";var r,o,i,u,c=n(10),s=n(0),f=n(5),a=n(11),l=n(25),d=n(4),p=n(6),v=n(30),h=n(31),y=n(37),m=n(20).set,_=n(40)(),x=n(21),g=n(41),b=n(42),w=n(43),j=s.TypeError,P=s.process,S=P&&P.versions,O=S&&S.v8||"",M=s.Promise,E="process"==a(P),T=function(){},C=o=x.f,k=!!function(){try{var t=M.resolve(1),e=(t.constructor={})[n(1)("species")]=function(t){t(T,T)};return(E||"function"==typeof PromiseRejectionEvent)&&t.then(T)instanceof e&&0!==O.indexOf("6.6")&&-1===b.indexOf("Chrome/66")}catch(t){}}(),A=function(t){var e;return!(!d(t)||"function"!=typeof(e=t.then))&&e},F=function(t,e){if(!t._n){t._n=!0;var n=t._c;_((function(){for(var r=t._v,o=1==t._s,i=0,u=function(e){var n,i,u,c=o?e.ok:e.fail,s=e.resolve,f=e.reject,a=e.domain;try{c?(o||(2==t._h&&W(t),t._h=1),!0===c?n=r:(a&&a.enter(),n=c(r),a&&(a.exit(),u=!0)),n===e.promise?f(j("Promise-chain cycle")):(i=A(n))?i.call(n,s,f):s(n)):f(r)}catch(t){a&&!u&&a.exit(),f(t)}};n.length>i;)u(n[i++]);t._c=[],t._n=!1,e&&!t._h&&R(t)}))}},R=function(t){m.call(s,(function(){var e,n,r,o=t._v,i=I(t);if(i&&(e=g((function(){E?P.emit("unhandledRejection",o,t):(n=s.onunhandledrejection)?n({promise:t,reason:o}):(r=s.console)&&r.error&&r.error("Unhandled promise rejection",o)})),t._h=E||I(t)?2:1),t._a=void 0,i&&e.e)throw e.v}))},I=function(t){return 1!==t._h&&0===(t._a||t._c).length},W=function(t){m.call(s,(function(){var e;E?P.emit("rejectionHandled",t):(e=s.onrejectionhandled)&&e({promise:t,reason:t._v})}))},N=function(t){var e=this;e._d||(e._d=!0,(e=e._w||e)._v=t,e._s=2,e._a||(e._a=e._c.slice()),F(e,!0))},U=function t(e){var n,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===e)throw j("Promise can't be resolved itself");(n=A(e))?_((function(){var o={_w:r,_d:!1};try{n.call(e,f(t,o,1),f(N,o,1))}catch(t){N.call(o,t)}})):(r._v=e,r._s=1,F(r,!1))}catch(t){N.call({_w:r,_d:!1},t)}}};k||(M=function(t){v(this,M,"Promise","_h"),p(t),r.call(this);try{t(f(U,this,1),f(N,this,1))}catch(t){N.call(this,t)}},(r=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(44)(M.prototype,{then:function(t,e){var n=C(y(this,M));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=E?P.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&F(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),i=function(){var t=new r;this.promise=t,this.resolve=f(U,t,1),this.reject=f(N,t,1)},x.f=C=function(t){return t===M||t===u?new i(t):o(t)}),l(l.G+l.W+l.F*!k,{Promise:M}),n(45)(M,"Promise"),n(46)("Promise"),u=n(2).Promise,l(l.S+l.F*!k,"Promise",{reject:function(t){var e=C(this);return(0,e.reject)(t),e.promise}}),l(l.S+l.F*(c||!k),"Promise",{resolve:function(t){return w(c&&this===u?M:this,t)}}),l(l.S+l.F*!(k&&n(47)((function(t){M.all(t).catch(T)}))),"Promise",{all:function(t){var e=this,n=C(e),r=n.resolve,o=n.reject,i=g((function(){var n=[],i=0,u=1;h(t,!1,(function(t){var c=i++,s=!1;n.push(void 0),u++,e.resolve(t).then((function(t){s||(s=!0,n[c]=t,--u||r(n))}),o)})),--u||r(n)}));return i.e&&o(i.v),n.promise},race:function(t){var e=this,n=C(e),r=n.reject,o=g((function(){h(t,!1,(function(t){e.resolve(t).then(n.resolve,r)}))}));return o.e&&r(o.v),n.promise}})},function(t,e,n){"use strict";var r=n(0),o=n(2),i=n(14),u=n(17),c=n(5),s=function t(e,n,s){var f,a,l,d,p=e&t.F,v=e&t.G,h=e&t.P,y=e&t.B,m=v?r:e&t.S?r[n]||(r[n]={}):(r[n]||{}).prototype,_=v?o:o[n]||(o[n]={}),x=_.prototype||(_.prototype={});for(f in v&&(s=n),s)l=((a=!p&&m&&void 0!==m[f])?m:s)[f],d=y&&a?c(l,r):h&&"function"==typeof l?c(Function.call,l):l,m&&u(m,f,l,e&t.U),_[f]!=l&&i(_,f,d),h&&x[f]!=l&&(x[f]=l)};r.core=o,s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,t.exports=s},function(t,e,n){"use strict";t.exports=!n(7)&&!n(15)((function(){return 7!=Object.defineProperty(n(16)("div"),"a",{get:function(){return 7}}).a}))},function(t,e,n){"use strict";var r=n(4);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){"use strict";t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){"use strict";t.exports=n(12)("native-function-to-string",Function.toString)},function(t,e,n){"use strict";t.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},function(t,e,n){"use strict";var r=n(5),o=n(32),i=n(33),u=n(3),c=n(34),s=n(36),f={},a={},l=t.exports=function(t,e,n,l,d){var p,v,h,y,m=d?function(){return t}:s(t),_=r(n,l,e?2:1),x=0;if("function"!=typeof m)throw TypeError(t+" is not iterable!");if(i(m)){for(p=c(t.length);p>x;x++)if((y=e?_(u(v=t[x])[0],v[1]):_(t[x]))===f||y===a)return y}else for(h=m.call(t);!(v=h.next()).done;)if((y=o(h,_,v.value,e))===f||y===a)return y};l.BREAK=f,l.RETURN=a},function(t,e,n){"use strict";var r=n(3);t.exports=function(t,e,n,o){try{return o?e(r(n)[0],n[1]):e(n)}catch(e){var i=t.return;throw void 0!==i&&r(i.call(t)),e}}},function(t,e,n){"use strict";var r=n(19),o=n(1)("iterator"),i=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||i[o]===t)}},function(t,e,n){"use strict";var r=n(35),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e,n){"use strict";var r=Math.ceil,o=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?o:r)(t)}},function(t,e,n){"use strict";var r=n(11),o=n(1)("iterator"),i=n(19);t.exports=n(2).getIteratorMethod=function(t){if(null!=t)return t[o]||t["@@iterator"]||i[r(t)]}},function(t,e,n){"use strict";var r=n(3),o=n(6),i=n(1)("species");t.exports=function(t,e){var n,u=r(t).constructor;return void 0===u||null==(n=r(u)[i])?e:o(n)}},function(t,e,n){"use strict";t.exports=function(t,e,n){var r=void 0===n;switch(e.length){case 0:return r?t():t.call(n);case 1:return r?t(e[0]):t.call(n,e[0]);case 2:return r?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},function(t,e,n){"use strict";var r=n(0).document;t.exports=r&&r.documentElement},function(t,e,n){"use strict";var r=n(0),o=n(20).set,i=r.MutationObserver||r.WebKitMutationObserver,u=r.process,c=r.Promise,s="process"==n(8)(u);t.exports=function(){var t,e,n,f=function(){var r,o;for(s&&(r=u.domain)&&r.exit();t;){o=t.fn,t=t.next;try{o()}catch(r){throw t?n():e=void 0,r}}e=void 0,r&&r.enter()};if(s)n=function(){u.nextTick(f)};else if(!i||r.navigator&&r.navigator.standalone)if(c&&c.resolve){var a=c.resolve(void 0);n=function(){a.then(f)}}else n=function(){o.call(r,f)};else{var l=!0,d=document.createTextNode("");new i(f).observe(d,{characterData:!0}),n=function(){d.data=l=!l}}return function(r){var o={fn:r,next:void 0};e&&(e.next=o),t||(t=o,n()),e=o}}},function(t,e,n){"use strict";t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},function(t,e,n){"use strict";var r=n(0).navigator;t.exports=r&&r.userAgent||""},function(t,e,n){"use strict";var r=n(3),o=n(4),i=n(21);t.exports=function(t,e){if(r(t),o(e)&&e.constructor===t)return e;var n=i.f(t);return(0,n.resolve)(e),n.promise}},function(t,e,n){"use strict";var r=n(17);t.exports=function(t,e,n){for(var o in e)r(t,o,e[o],n);return t}},function(t,e,n){"use strict";var r=n(9).f,o=n(18),i=n(1)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},function(t,e,n){"use strict";var r=n(0),o=n(9),i=n(7),u=n(1)("species");t.exports=function(t){var e=r[t];i&&e&&!e[u]&&o.f(e,u,{configurable:!0,get:function(){return this}})}},function(t,e,n){"use strict";var r=n(1)("iterator"),o=!1;try{var i=[7][r]();i.return=function(){o=!0},Array.from(i,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!o)return!1;var n=!1;try{var i=[7],u=i[r]();u.next=function(){return{done:n=!0}},i[r]=function(){return u},t(i)}catch(t){}return n}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"//vod.bytedanceapi.com";return new Promise((function(n,r){if(e&&t){var o=JSON.parse(i.default.base64decode(t)),u=e+"?"+o.GetPlayInfoToken;wx.request({url:u,method:"GET",success:function(t){t.data&&t.data.Result?n(t.data.Result):n(t.data||t)},fail:function(){r("request error")}})}else r("vid, host and token can't be empty")}))};var r,o=n(49),i=(r=o)&&r.__esModule?r:{default:r};t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r={base64decode:function(t){var e,n,r,o,i,u,c,s=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1];for(u=t.length,i=0,c="";i<u;){do{e=s[255&t.charCodeAt(i++)]}while(i<u&&-1===e);if(-1===e)break;do{n=s[255&t.charCodeAt(i++)]}while(i<u&&-1===n);if(-1===n)break;c+=String.fromCharCode(e<<2|(48&n)>>4);do{if(61===(r=255&t.charCodeAt(i++)))return c;r=s[r]}while(i<u&&-1===r);if(-1===r)break;c+=String.fromCharCode((15&n)<<4|(60&r)>>2);do{if(61===(o=255&t.charCodeAt(i++)))return c;o=s[o]}while(i<u&&-1===o);if(-1===o)break;c+=String.fromCharCode((3&r)<<6|o)}return c}};e.default=r,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){return void 0===s&&(s=!r&&!o&&"undefined"!=typeof global),s};e.hasProto="__proto__"in{};var r=e.inBrowser="undefined"!=typeof window,o=e.inWeex="undefined"!=typeof WXEnvironment&&!!WXEnvironment.platform,i=e.weexPlatform=o&&WXEnvironment.platform.toLowerCase(),u=e.UA=r&&window.navigator.userAgent.toLowerCase(),c=(e.isIE=u&&/msie|trident/.test(u),e.isIE9=u&&u.indexOf("msie 9.0")>0,e.isEdge=u&&u.indexOf("edge/")>0),s=(e.isAndroid=u&&u.indexOf("android")>0||"android"===i,e.isIOS=u&&/iphone|ipad|ipod|ios/.test(u)||"ios"===i,e.isChrome=u&&/chrome\/\d+/.test(u)&&!c,void 0)}]);
module.exports=function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=i(r(2)),n=i(r(4));function i(e){return e&&e.__esModule?e:{default:e}}t.default={url:o.default,uid:!(0,n.default)()&&document&&document.cookie&&/tt_webid=(\d+)/gi.test(document.cookie)?RegExp.$1:""},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"//vod.bytedanceapi.com";return new Promise((function(r,o){if(t&&e){var n=JSON.parse(i.default.base64decode(e)),d=t+"?"+n.GetPlayInfoToken;wx.request({url:d,method:"GET",success:function(e){e.data&&e.data.Result?r(e.data.Result):r(e.data||e)},fail:function(){o("request error")}})}else o("vid, host and token can't be empty")}))};var o,n=r(3),i=(o=n)&&o.__esModule?o:{default:o};e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o={base64decode:function(e){var t,r,o,n,i,d,u,a=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1];for(d=e.length,i=0,u="";i<d;){do{t=a[255&e.charCodeAt(i++)]}while(i<d&&-1===t);if(-1===t)break;do{r=a[255&e.charCodeAt(i++)]}while(i<d&&-1===r);if(-1===r)break;u+=String.fromCharCode(t<<2|(48&r)>>4);do{if(61===(o=255&e.charCodeAt(i++)))return u;o=a[o]}while(i<d&&-1===o);if(-1===o)break;u+=String.fromCharCode((15&r)<<4|(60&o)>>2);do{if(61===(n=255&e.charCodeAt(i++)))return u;n=a[n]}while(i<d&&-1===n);if(-1===n)break;u+=String.fromCharCode((3&o)<<6|n)}return u}};t.default=o,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return void 0===a&&(a=!o&&!n&&"undefined"!=typeof global),a};t.hasProto="__proto__"in{};var o=t.inBrowser="undefined"!=typeof window,n=t.inWeex="undefined"!=typeof WXEnvironment&&!!WXEnvironment.platform,i=t.weexPlatform=n&&WXEnvironment.platform.toLowerCase(),d=t.UA=o&&window.navigator.userAgent.toLowerCase(),u=(t.isIE=d&&/msie|trident/.test(d),t.isIE9=d&&d.indexOf("msie 9.0")>0,t.isEdge=d&&d.indexOf("edge/")>0),a=(t.isAndroid=d&&d.indexOf("android")>0||"android"===i,t.isIOS=d&&/iphone|ipad|ipod|ios/.test(d)||"ios"===i,t.isChrome=d&&/chrome\/\d+/.test(d)&&!u,void 0)}]);

@@ -9,20 +9,20 @@ "use strict";

value: true,
observer(newVal, oldVal, _changedPath) {
observer(newVal, _changedPath) {
const stateClass = newVal ? 'xg-bottom-progress-hide' : '';
this.setData({
stateClass
stateClass,
});
}
},
},
buffered: {
type: Number,
value: 0
value: 0,
},
played: {
type: Number,
value: 0
value: 0,
},
strokeWidth: {
type: Number,
value: 2
value: 2,
},

@@ -35,38 +35,22 @@ borderRadius: {

type: String,
value: 'rgba(255, 255, 255, 0.2)'
value: 'rgba(255, 255, 255, 0.2)',
},
cacheColor: {
type: String,
value: 'rgba(255, 255, 255, 0.38)'
value: 'rgba(255, 255, 255, 0.38)',
},
playedColor: {
type: String,
value: '#FFFFFF'
}
value: '#FFFFFF',
},
},
data: {
stateClass: 'xg-bottom-progress-hide'
stateClass: 'xg-bottom-progress-hide',
},
observers: {},
lifetimes: {
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
created: function () { },
attached: function () { },
ready: function () {
// console.log('[progress]>>>ready', this.properties.videoId)
// this.addMediaEvents(mediaManager)
},
moved: function () { },
detached: function () {
// console.log('[progress]>>>detached')
// this.removeMediaEvents(mediaManager)
},
},
lifetimes: {},
pageLifetimes: {
// 组件所在页面的生命周期函数
show: function () { },
hide: function () { },
resize: function () { },
// 组件所在页面的生命周期函数
},
methods: {}
methods: {},
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("../../utils/index");
const userActionBehavior_1 = require("../../behaviors/userActionBehavior");
const plugin_useraction_behavior_1 = require("../../behaviors/plugin_useraction_behavior");
(0, index_1.XgComponent)({
behaviors: [userActionBehavior_1.default],
behaviors: [plugin_useraction_behavior_1.default],
properties: {
isHidden: {
type: Boolean,
value: true
value: true,
observer(newVal, _changedPath) {
newVal ? this.hideControls() : this.showControls();
},
},
// 不同的模式需要确定是否需要添加底部边距
mode: {
type: String,
value: "portrait" /* PlayerModes.PORTRAIT */,
observer(newVal, oldVal, _changedPath) {
// 竖屏或者全屏的时候增加底部边距处理
observer(newVal, _oldVal, _changedPath) {
if (newVal === "portrait" /* PlayerModes.PORTRAIT */ || newVal === "fullscreen" /* PlayerModes.FULLSCREEN */) {
this.setData({
modeClass: 'xgplayer-controls-portrait'
modeClass: 'xgplayer-controls-portrait',
});

@@ -24,22 +27,26 @@ }

this.setData({
modeClass: ''
modeClass: '',
});
}
}
}
},
},
},
data: {
modeClass: 'xgplayer-controls-portrait'
// stateClass: 'xgplayer-controls-hide',
stateClass: 'xgplayer-controls-portrait',
},
lifetimes: {
created() {
this.pluginName = 'Controls';
},
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
attached: function () { },
moved: function () { },
detached: function () { },
// attached: function () { },
// moved: function () { },
// detached: function () { },
},
pageLifetimes: {
// 组件所在页面的生命周期函数
show: function () { },
hide: function () { },
resize: function () { },
// 组件所在页面的生命周期函数
// show: function () { },
// hide: function () { },
// resize: function () { },
},

@@ -49,3 +56,3 @@ methods: {

this.setData({
isHidden: true
isHidden: true,
});

@@ -55,6 +62,6 @@ },

this.setData({
isHidden: false
isHidden: false,
});
}
}
},
},
});

@@ -14,3 +14,3 @@ "use strict";

type: String,
value: 'hide'
value: 'hide',
},

@@ -22,4 +22,4 @@ /**

type: Object,
value: undefined
}
value: undefined,
},
},

@@ -33,3 +33,3 @@ /**

// console.log('component loading ready:', this.data);
}
},
},

@@ -42,4 +42,4 @@ /**

this.triggerEvent('retry');
}
}
},
},
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("../../utils/index");
var LOADING_TYPES;
(function (LOADING_TYPES) {
LOADING_TYPES["DEFAULT"] = "";
LOADING_TYPES["LARGE_BG"] = "loading-large-bg";
})(LOADING_TYPES || (LOADING_TYPES = {}));
(0, index_1.XgComponent)({

@@ -14,4 +19,12 @@ /**

type: String,
value: 'hide'
}
value: 'hide',
},
type: {
type: String,
value: 'small',
},
text: {
type: String,
value: '正在缓冲…',
},
},

@@ -21,7 +34,24 @@ /**

*/
data: {},
data: {
typeClassName: '',
},
lifetimes: {
ready() {
// console.log('component loading ready:', this.data);
}
const { type } = this.properties;
let _cname = '';
switch (type) {
case 'default':
_cname = "" /* LOADING_TYPES.DEFAULT */;
break;
case 'large-bg':
_cname = "loading-large-bg" /* LOADING_TYPES.LARGE_BG */;
break;
default:
//
}
this.setData({
typeClassName: _cname,
});
},
},

@@ -31,3 +61,3 @@ /**

*/
methods: {}
methods: {},
});

@@ -10,3 +10,3 @@ "use strict";

src: {
type: String
type: String,
},

@@ -19,4 +19,4 @@ /**

type: String,
value: 'aspectFit'
}
value: 'aspectFit',
},
},

@@ -27,3 +27,3 @@ /**

data: {
loaded: false
loaded: false,
},

@@ -33,3 +33,3 @@ lifetimes: {

// console.log('component poster ready:', this.data);
}
},
},

@@ -42,7 +42,9 @@ /**

this.setData({
loaded: true
loaded: true,
});
},
onError() { }
}
onError() {
//
},
},
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable no-magic-numbers */
/* eslint-disable @typescript-eslint/no-magic-numbers */
/* eslint-disable @typescript-eslint/naming-convention */
const videoEventsBehavior_1 = require("../../behaviors/videoEventsBehavior");

@@ -12,15 +15,15 @@ const index_1 = require("../../tool/index");

type: String,
value: 'progress'
value: 'progress',
},
blockSize: {
type: Number,
value: 12
value: 12,
},
blockColor: {
type: String,
value: '#ffffff'
value: '#ffffff',
},
strokeWidth: {
type: Number,
value: 2
value: 2,
},

@@ -33,12 +36,12 @@ borderRadius: {

type: String,
value: 'rgba(255, 255, 255, 0.2)'
value: 'rgba(255, 255, 255, 0.2)',
},
cacheColor: {
type: String,
value: 'rgba(255, 255, 255, 0.38)'
value: 'rgba(255, 255, 255, 0.38)',
},
playedColor: {
type: String,
value: '#FFFFFF'
}
value: '#FFFFFF',
},
},

@@ -56,15 +59,14 @@ data: {

currentTimeText: '00:00',
blockStyle: 'left: 0'
blockStyle: 'left: 0',
},
lifetimes: {
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
created: function () { },
attached: function () { },
ready: function () {
// created() {},
// attached () { },
ready() {
this.dragStartTime = -1;
// console.log('!!!![progress]>>>ready', this.properties.videoId)
this.addMediaEvents(index_1.default);
},
moved: function () { },
detached: function () {
// moved () { },
detached() {
// console.log('[progress]>>>detached')

@@ -75,12 +77,9 @@ this.removeMediaEvents(index_1.default);

pageLifetimes: {
// 组件所在页面的生命周期函数
show: function () { },
hide: function () { },
resize: function () { },
// 组件所在页面的生命周期函数
},
methods: {
onClick: function (e) {
onClick() {
// 空方法,用于阻止进度条的点击事件冒泡
},
_onTimeupdate: function (data) {
_onTimeupdate(data) {
const { currentTime, duration, playPercent } = data.data;

@@ -91,4 +90,4 @@ if (!this.data.isActive && !this.data.isSeeking) {

blockStyle: `left:${playPercent}%;`,
currentTime: currentTime,
currentTimeText: (0, index_2.format)(currentTime)
currentTime,
currentTimeText: (0, index_2.format)(currentTime),
});

@@ -99,14 +98,14 @@ }

duration,
durationText: (0, index_2.format)(duration)
durationText: (0, index_2.format)(duration),
});
}
},
_onProgress: function (data) {
const { buffered, bufferedTime } = data.data;
_onProgress(data) {
const { buffered } = data.data;
// console.log('[progress]>_onProgress', buffered, bufferedTime)
this.setData({
buffered: buffered
buffered,
});
},
_onLoadedmetadata: function (data) {
_onLoadedmetadata(data) {
const { duration } = data.data;

@@ -116,19 +115,19 @@ // console.log('[progress]>_onLoadedmetadata', duration, format(duration))

duration,
durationText: (0, index_2.format)(duration)
durationText: (0, index_2.format)(duration),
});
},
_onSeekcomplete: function (e) {
//// console.log('[progress]_onSeekComplete')
_onSeekcomplete() {
// // console.log('[progress]_onSeekComplete')
this.setData({
isSeeking: false
isSeeking: false,
});
},
onProgressChange: function (e) {
onProgressChange(e) {
const { value } = e.detail;
const { duration } = this.data;
this.setData({
isActive: false,
});
if (!duration) {
this.dragStartTime = -1;
this.setData({
isActive: false
});
return;

@@ -141,11 +140,9 @@ }

actionType: 'seekend',
componentName: "progress",
componentName: 'progress',
props: 'currentTime',
from: this.dragStartTime,
to: seekTime
to: seekTime,
});
// console.log('>>>onChange', e.detail, value, this.data.duration, seekTime)
this.setData({
isActive: false,
isSeeking: true
isSeeking: true,
});

@@ -155,3 +152,3 @@ this.dragStartTime = -1;

},
onProgressChanging: function (e) {
onProgressChanging(e) {
const { value } = e.detail;

@@ -168,5 +165,5 @@ const { duration } = this.data;

actionType: 'seekstart',
componentName: "progress",
componentName: 'progress',
props: 'currentTime',
from: cTime
from: cTime,
});

@@ -176,6 +173,11 @@ }

isActive: true,
currentTimeText: (0, index_2.format)(cTime)
currentTimeText: (0, index_2.format)(cTime),
});
}
}
},
onTouchEnd() {
this.setData({
isActive: false,
});
},
},
});

@@ -14,3 +14,3 @@ "use strict";

type: String,
value: 'show'
value: 'show',
},

@@ -22,4 +22,4 @@ /**

type: String,
value: 'small'
}
value: 'small',
},
},

@@ -32,3 +32,3 @@ /**

ctx: null,
sizeClassName: 'xg-icon-middle'
sizeClassName: 'xg-icon-middle',
},

@@ -40,3 +40,3 @@ lifetimes: {

width: '',
height: ''
height: '',
};

@@ -46,3 +46,3 @@ switch (size) {

this.setData({
sizeClassName: 'xg-icon-large'
sizeClassName: 'xg-icon-large',
});

@@ -52,10 +52,12 @@ break;

this.setData({
sizeClassName: 'xg-icon-small'
sizeClassName: 'xg-icon-small',
});
break;
default:
//
}
this.setData({
style: (0, index_1.styleToText)(style)
style: (0, index_1.styleToText)(style),
});
}
},
},

@@ -67,3 +69,3 @@ /**

onClick() {
const { paused, media } = this.data;
// const { paused, media } = this.data;
// if (media) {

@@ -76,4 +78,4 @@ // if (paused) {

// }
}
}
},
},
});

@@ -5,6 +5,6 @@ "use strict";

const videoEventsBehavior_1 = require("../../behaviors/videoEventsBehavior");
const userActionBehavior_1 = require("../../behaviors/userActionBehavior");
const plugin_useraction_behavior_1 = require("../../behaviors/plugin_useraction_behavior");
const index_2 = require("../../tool/index");
(0, index_1.XgComponent)({
behaviors: [videoEventsBehavior_1.default, userActionBehavior_1.default],
behaviors: [videoEventsBehavior_1.default, plugin_useraction_behavior_1.default],
/**

@@ -19,3 +19,3 @@ * 组件的属性列表

type: Boolean,
value: false
value: false,
},

@@ -27,3 +27,3 @@ /**

type: String,
value: 'center'
value: 'center',
},

@@ -35,3 +35,3 @@ /**

type: String,
value: "normal" /* PLAY_BTN_MODE.NORMAL */
value: "normal" /* PLAY_BTN_MODE.NORMAL */,
},

@@ -43,3 +43,3 @@ /**

type: String,
value: 'small'
value: 'small',
},

@@ -51,4 +51,4 @@ /**

type: Boolean,
value: true
}
value: true,
},
},

@@ -65,9 +65,13 @@ /**

lifetimes: {
created() {
this.pluginName = 'PlayButton';
},
ready() {
const { size, position, mode } = this.properties;
const _data = {
index_1.VE_DEBUGGER.log(this.pluginName, 'ready', `size:${size}, position:${position}, mode:${mode}`);
const data = {
sizeClassName: this.getSizeClass(size),
styleClassName: this.getPositionClass(position, mode)
styleClassName: this.getPositionClass(position, mode),
};
this.setData(_data);
this.setData(data);
this.addMediaEvents(index_2.default);

@@ -77,3 +81,3 @@ },

this.removeMediaEvents(index_2.default);
}
},
},

@@ -85,30 +89,32 @@ /**

getSizeClass(size) {
let _ret = '';
let ret = '';
switch (size) {
case 'large':
_ret = 'xg-icon-large';
ret = 'xg-icon-large';
break;
case 'small':
_ret = 'xg-icon-small';
ret = 'xg-icon-small';
break;
default:
_ret = 'xg-icon-middle';
ret = 'xg-icon-middle';
}
return _ret;
return ret;
},
getPositionClass(position, mode) {
let _ret = '';
let ret = '';
switch (position) {
case "center" /* PLAY_BTN_POSITION.CENTER */:
_ret = 'xg-play-center';
ret = 'xg-play-center';
break;
case "center-bottom" /* PLAY_BTN_POSITION.CENTER_BOTTOM */:
_ret = 'xg-play-bottom';
ret = 'xg-play-bottom';
break;
default:
ret = 'xg-play-center';
}
index_1.VE_DEBUGGER.log(this.pluginName, '[getPositionClass]', `class:${ret} position:${position} mode:${mode}`);
if (mode === "bg" /* PLAY_BTN_MODE.BG */) {
_ret = (0, index_1.classNames)(_ret, 'xg-icon-bg');
ret = (0, index_1.classNames)(ret, 'xg-icon-bg');
}
return _ret;
return ret;
},

@@ -121,3 +127,3 @@ onClick(e) {

from: paused,
to: !paused
to: !paused,
};

@@ -133,4 +139,4 @@ if (this.media) {

this.triggerUserAction('playbtn', e, data);
}
}
},
},
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable object-shorthand */
const mediaManager = {

@@ -26,3 +27,3 @@ name: 'mediaManager',

id: videoId,
media: media
media: media,
});

@@ -45,8 +46,8 @@ }

const _index = this._findById(videoId);
//console.log('mediaManager>removeMedia', videoId, _index)
// console.log('mediaManager>removeMedia', videoId, _index)
if (_index >= 0) {
return this._list.splice(_index, 1);
}
}
},
};
exports.default = mediaManager;

@@ -19,3 +19,3 @@ "use strict";

*/
styleIsolation: 'apply-shared'
styleIsolation: 'apply-shared',
}, options.options || {});

@@ -22,0 +22,0 @@ Component(options);

@@ -7,5 +7,3 @@ "use strict";

Object.keys(style).forEach((key) => {
const bbqKey = key.replace(/[A-Z]/g, (val) => {
return '-' + val.toLowerCase();
});
const bbqKey = key.replace(/[A-Z]/g, (val) => `-${val.toLowerCase()}`);
cssText += `${bbqKey}:${style[key]};`;

@@ -12,0 +10,0 @@ });

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEBUG = void 0;
const DEBUG_OPEN = false;
const useColor = false;
const STYLE = useColor
? {
info: 'color: #525252; background-color: #90ee90;',
error: 'color: #525252; background-color: red;',
warn: 'color: #525252; background-color: yellow; '
}
: {};
const TAG = `${useColor ? '%c' : ''}[xgplayer-mp-weapp]`;
exports.DEBUG = {
config: {
debug: DEBUG_OPEN ? 3 : 1
exports.VE_DEBUGGER = void 0;
const index_1 = require("../enums/index");
exports.VE_DEBUGGER = {
debugger: 1,
log(...msg) {
if (this.debugger > 0) {
console.log(`[${index_1.PKG}_${index_1.VERSION}]`, ...msg);
}
},
logInfo(message, ...optionalParams) {
this.config.debug >= 3 && console.log(TAG, STYLE.info, message, ...optionalParams);
warn(...msg) {
if (this.debugger > 0) {
console.warn(`[${index_1.PKG}_${index_1.VERSION}]`, ...msg);
}
},
logWarn(message, ...optionalParams) {
this.config.debug >= 1 && console.warn(TAG, STYLE.warn, message, ...optionalParams);
},
logError(message, ...optionalParams) {
if (this.config.debug < 1) {
return;
}
const _fun = this.config.debug >= 2 ? 'trace' : 'error';
console[_fun](TAG, STYLE.error, message, ...optionalParams);
}
};

@@ -17,3 +17,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getSystemInfoSync = exports.getTouch = exports.classNames = exports.format = exports.padStart = void 0;
exports.getTouch = exports.classNames = exports.format = exports.padStart = void 0;
/* eslint-disable no-magic-numbers */
/* eslint-disable @typescript-eslint/no-magic-numbers */
/**

@@ -41,3 +43,3 @@ * Util

if (time >= 10) {
return time + '';
return `${time}`;
}

@@ -49,2 +51,3 @@ else {

function format(time) {
// eslint-disable-next-line no-restricted-globals
if (isNaN(time)) {

@@ -70,3 +73,3 @@ return '00:00';

function classNames(...args) {
let classnames = [];
const classnames = [];
args.forEach((item) => {

@@ -93,19 +96,1 @@ if (typeOf(item) === 'String') {

exports.getTouch = getTouch;
function getSystemInfoSync() {
try {
const res = wx.getSystemInfoSync();
console.log('>>>getSystemInfoSync model', res.model);
console.log('>>>getSystemInfoSync', res.pixelRatio);
console.log('>>>getSystemInfoSync windowWidth', res.windowWidth);
console.log('>>>getSystemInfoSync windowHeight', res.windowHeight);
console.log('>>>getSystemInfoSync bottom', res.bottom);
// console.log(res.language)
// console.log(res.version)
// console.log(res.platform)
return res;
}
catch (e) {
return {};
}
}
exports.getSystemInfoSync = getSystemInfoSync;

@@ -7,3 +7,3 @@ "use strict";

// While there remain elements to shuffle.
while (currentIndex != 0) {
while (currentIndex !== 0) {
// Pick a remaining element.

@@ -10,0 +10,0 @@ randomIndex = Math.floor(Math.random() * currentIndex);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateUppercaseUid = exports.generateLowercaseUid = exports.generateBaseStrUid = exports.generateUid = void 0;
/* eslint-disable @typescript-eslint/comma-dangle */
const shuffle_1 = require("./shuffle");

@@ -12,3 +13,3 @@ function generateUid() {

u /* uppercase */: true,
l /* lowercase */: true
l /* lowercase */: true,
}) {

@@ -15,0 +16,0 @@ const codes = [];

{
"name": "veplayer-mp-wechat",
"version": "1.2.2",
"version": "1.2.3-alpha.0",
"license": "MIT",
"miniprogram": "dist",
"description": "小程序播放器微信原生版",
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"files": [
"dist",
"postinstall.js",
"README.md"
"README.md",
"postinstall.js"
],

@@ -20,7 +24,4 @@ "scripts": {

"eventemitter3": "^5.0.1",
"xgplayer-service-miniprogram": "^0.4.0"
},
"devDependencies": {
"fs-extra": "^11.1.1"
"xgplayer-service-miniprogram": "^0.5.0"
}
}

@@ -1,28 +0,53 @@

const path = require('path');
const fs = require('fs-extra');
const path = require('path')
const fs = require('fs')
function copyFolderSync(source, target) {
if (!fs.existsSync(target)) {
fs.mkdirSync(target)
}
fs.readdirSync(source).forEach((file) => {
const sourcePath = path.join(source, file)
const targetPath = path.join(target, file)
if (fs.lstatSync(sourcePath).isDirectory()) {
copyFolderSync(sourcePath, targetPath)
} else {
fs.copyFileSync(sourcePath, targetPath)
}
})
}
async function main() {
const isExitSrc = fs.existsSync(path.join(__dirname, '../../src'));
const isUni = fs.existsSync(path.join(__dirname, '../../node_modules/@dcloudio')) || fs.existsSync(path.join(__dirname, `../../${isExitSrc ? 'src/' : '' }/pages.json`));
const isTaro = fs.existsSync(path.join(__dirname, '../../node_modules/@tarojs'));
const isExitSrc = fs.existsSync(path.join(__dirname, '../../src'))
const isUni =
fs.existsSync(path.join(__dirname, '../../node_modules/@dcloudio')) ||
fs.existsSync(path.join(__dirname, `../../${isExitSrc ? 'src/' : ''}/pages.json`))
const isTaro = fs.existsSync(path.join(__dirname, '../../node_modules/@tarojs'))
// 如果是uni或者taro项目,则执行复制
if (isUni || isTaro) {
const isExitSrc = fs.existsSync(path.join(__dirname, '../../src'));
const sourcePath = path.join(__dirname, '../../node_modules/veplayer-mp-wechat');
let targetPath = '';
const isExitTTCom = fs.existsSync(path.join(__dirname, `../../${isExitSrc ? 'src/' : '' }wxcomponents`));
const isExitSrc = fs.existsSync(path.join(__dirname, '../../src'))
const sourcePath = path.join(__dirname, '../../node_modules/veplayer-mp-wechat')
let targetPath = ''
const isExitTTCom = fs.existsSync(path.join(__dirname, `../../${isExitSrc ? 'src/' : ''}wxcomponents`))
// 不存在则新建文件夹
if (!isExitTTCom) {
const ttPath = fs.mkdirSync(path.join(__dirname, `../../${isExitSrc ? 'src/' : '' }wxcomponents`), { recursive: true });
const ttPath = fs.mkdirSync(path.join(__dirname, `../../${isExitSrc ? 'src/' : ''}wxcomponents`), {
recursive: true,
})
if (!ttPath) {
console.warn(`创建wxcomponents失败,请手动复制node_modules/veplayer-mp-wechat到${isExitSrc ? 'src/' : '' }wxcomponents`);
return;
console.warn(`创建wxcomponents失败,请手动复制node_modules/veplayer-mp-wechat到${isExitSrc ? 'src/' : ''}twxcomponents`)
return
}
}
targetPath = path.join(__dirname, `../../${isExitSrc ? 'src/' : '' }wxcomponents/veplayer-mp-wechat`);
fs.copySync(sourcePath, targetPath, { overwrite: true });
targetPath = path.join(__dirname, `../../${isExitSrc ? 'src/' : ''}wxcomponents/veplayer-mp-wechat`)
copyFolderSync(sourcePath, targetPath)
}
}
main();
try {
main()
} catch (err) {
console.warn('复制veplayer-mp-wechat失败,请手动复制node_modules/veplayer-mp-wechat到根目录下的wxcomponents')
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet