veplayer-mp-douyin
Advanced tools
Comparing version 1.0.4 to 1.0.5-alpha.0
@@ -17,3 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PlayerModes = void 0; | ||
exports.VERSION = exports.PKG = exports.PlayerModes = void 0; | ||
__exportStar(require("./errorCode"), exports); | ||
@@ -26,1 +26,3 @@ __exportStar(require("./events"), exports); | ||
})(PlayerModes = exports.PlayerModes || (exports.PlayerModes = {})); | ||
exports.PKG = 'veplayer-mp-douyin'; | ||
exports.VERSION = '"1.0.5-alpha.0'; |
@@ -70,5 +70,20 @@ "use strict"; | ||
}, | ||
/** | ||
* @description 是否允许空资源起播 | ||
* 如果传入true, 则当src和playAuthToken为空的时候不触发播放错误,只显示loading,等待用户更新src或者playAuthToken | ||
*/ | ||
allowNullSource: { | ||
type: Boolean, | ||
value: true, | ||
}, | ||
veDebugger: { | ||
type: Number, | ||
value: 0, | ||
}, | ||
loadingText: { | ||
type: Number, | ||
value: '正在加载...', | ||
}, | ||
}, | ||
data: { | ||
version: '0.0.2', | ||
videoId: '', | ||
@@ -105,2 +120,3 @@ videoProps: {}, | ||
canUseOtherType: true, | ||
isHidden: false, // 是否隐藏video组件 | ||
}, | ||
@@ -128,2 +144,3 @@ observers: { | ||
isLoadingData: false, | ||
isHidden: false, | ||
}); | ||
@@ -136,2 +153,3 @@ this.updateCollector({ | ||
const { src, definitionList, playAuthToken, playDomain, isLoadingData } = this.data; | ||
index_2.VE_DEBUGGER.log('sourceChange', src, playAuthToken, isLoadingData); | ||
this.triggerCollector('break'); | ||
@@ -148,2 +166,3 @@ this.updateCollector(this.data); | ||
currentSrc: src, | ||
isHidden: false, | ||
isLoadingData: false, | ||
@@ -157,4 +176,6 @@ }); | ||
}); | ||
index_2.VE_DEBUGGER.log('serviceRequest start'); | ||
(0, request_1.serviceRequest)(playAuthToken, playDomain || undefined) | ||
.then(data => { | ||
index_2.VE_DEBUGGER.log('serviceRequest res', data); | ||
if (data.error) { | ||
@@ -164,2 +185,3 @@ this.setData({ | ||
error: data.error, | ||
isHidden: false, | ||
}); | ||
@@ -171,41 +193,6 @@ } | ||
currentSrc: data.url, | ||
isHidden: false, | ||
}); | ||
} | ||
}); | ||
// ServiceRequest(playAuthToken, playDomain || undefined) | ||
// .then((res) => { | ||
// const data = 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: false, | ||
// currentSrc: defaultDef.MainPlayUrl, | ||
// }) | ||
// if (qualityList.length > 0) { | ||
// this.setData({ | ||
// playbackDefinition: defaultDef.Bitrate, | ||
// playbackDefinitionList: qualityList, | ||
// }) | ||
// } | ||
// } else { | ||
// this.setData({ | ||
// isLoadingData: false, | ||
// error: new XGError(ErrorCategory.SERVICE, ErrorCodes.SERVICE_PLAYINFOLIST_EMPTY, 'Service Error'), | ||
// }) | ||
// } | ||
// }) | ||
// .catch(() => { | ||
// this.setData({ | ||
// isLoadingData: false, | ||
// error: new XGError(ErrorCategory.SERVICE, ErrorCodes.SERVICE_UNKNOWN, 'Service Error'), | ||
// }) | ||
// }) | ||
} | ||
@@ -263,2 +250,3 @@ }, | ||
index_3.default.setMedia(_videoId, this.media); | ||
index_2.VE_DEBUGGER.log('canUseOtherType', canUse, this.properties.tagType); | ||
this.setData({ | ||
@@ -273,7 +261,13 @@ classNames: classNames.join(' '), | ||
ready() { | ||
const { controls } = this.properties; | ||
const { controls, src, allowNullSource, playAuthToken } = this.properties; | ||
const { currentSrc } = this.data; | ||
this.updateStatusOfShowLoading(); | ||
// console.log(`!!!!!Player${this.data.videoId} ready`, `controls:${controls}`, `data.controls:${this.data.controls}`) | ||
!!controls && this.focusPlayer(); | ||
// console.log('>>>onReady', `playBtnPosition:${playBtnPosition} loadedMeta:${loadedMeta} paused:${paused}`) | ||
index_2.VE_DEBUGGER.log('ready', !!this.media, `isHidden:${allowNullSource && !src && !currentSrc}`); | ||
// 允许空地址起播,且src和currentSrc都是空的时候隐藏video标签 | ||
if (!src && !currentSrc && (playAuthToken || allowNullSource)) { | ||
this.setData({ | ||
isHidden: true, | ||
}); | ||
} | ||
}, | ||
@@ -369,4 +363,5 @@ /** | ||
let { errMsg } = e.detail; | ||
const { isLoadingData, currentSrc } = this.data; | ||
if (!currentSrc && isLoadingData) { | ||
const { isLoadingData, currentSrc, allowNullSource } = this.data; | ||
index_2.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~~'); | ||
@@ -373,0 +368,0 @@ return; |
"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)({ | ||
@@ -16,2 +21,10 @@ /** | ||
}, | ||
type: { | ||
type: String, | ||
value: 'small', | ||
}, | ||
text: { | ||
type: String, | ||
value: '正在缓冲…', | ||
}, | ||
}, | ||
@@ -21,6 +34,23 @@ /** | ||
*/ | ||
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, | ||
}); | ||
}, | ||
@@ -27,0 +57,0 @@ }, |
@@ -27,2 +27,3 @@ "use strict"; | ||
retData.playbackDefinitionList = qualityList; | ||
// retData.error = new XGError(ErrorCategory.SERVICE, ErrorCodes.SERVICE_PLAYINFOLIST_EMPTY, 'FOR_TEST') | ||
} | ||
@@ -29,0 +30,0 @@ resolve(retData); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DEBUG = void 0; | ||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */ | ||
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); | ||
}, | ||
logWarn(message, ...optionalParams) { | ||
this.config.debug >= 1 && console.warn(TAG, STYLE.warn, message, ...optionalParams); | ||
}, | ||
logError(message, ...optionalParams) { | ||
if (this.config.debug < 1) { | ||
return; | ||
warn(...msg) { | ||
if (this.debugger > 0) { | ||
console.warn(`[${index_1.PKG}_${index_1.VERSION}]`, ...msg); | ||
} | ||
const _fun = this.config.debug >= 2 ? 'trace' : 'error'; | ||
console[_fun](TAG, STYLE.error, message, ...optionalParams); | ||
}, | ||
}; |
{ | ||
"name": "veplayer-mp-douyin", | ||
"version": "1.0.4", | ||
"version": "1.0.5-alpha.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "miniprogramType": "tt-npm", |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
136846
2156
2