veplayer-mp-douyin
Advanced tools
Comparing version 1.2.7-alpha.1 to 1.2.7-alpha.2
@@ -31,3 +31,5 @@ "use strict"; | ||
this.initCollector(); | ||
this.updateCollector(this.data); | ||
const { videoTagType } = this.data; | ||
console.log('>>>>data', this.data.albumId, this.data.videoTagType); | ||
this.updateCollector(Object.assign(Object.assign({}, this.data), { isVideoPlayer: videoTagType === "video-player" /* TAG_TYPE.VIDEO_PLAYER */ })); | ||
this.verifyCollector(); | ||
@@ -58,5 +60,7 @@ } | ||
updateCollector(videoInfo, config) { | ||
console.log('>>>updateCollector', videoInfo, this.collector); | ||
if (this.collector) { | ||
config && this.collector.setConfig(config); | ||
videoInfo && this.collector.setVideoInfo(videoInfo); | ||
console.log('>>>updateCollectorsssss', videoInfo, this.collector); | ||
} | ||
@@ -63,0 +67,0 @@ }, |
@@ -50,4 +50,7 @@ "use strict"; | ||
// this.setVideoPlayerStyle() | ||
this.onAidEidChange(); | ||
this.onTagTypeChange(); | ||
setTimeout(() => { | ||
this.onAidEidChange(); | ||
this.onVideoTagTypeChange(); | ||
console.log('>>>>ccc', this.collector.videoInfo); | ||
}); | ||
} | ||
@@ -59,41 +62,48 @@ }, | ||
}, | ||
tagType: function () { | ||
this.onTagTypeChange(); | ||
} | ||
}, | ||
methods: { | ||
onAidEidChange() { | ||
const { albumId, episodeId } = this.data; | ||
'videoTagType': function () { | ||
// videoTagType变化时,重新设置日志的isVideoPlayer参数 | ||
this.onVideoTagTypeChange(); | ||
}, | ||
'currentSrc, albumId, episodeId': function () { | ||
const { currentSrc, albumId, episodeId, tagType } = this.data; | ||
let videoTagType = ''; | ||
if (albumId && episodeId) { | ||
const canUse = tt.canIUse("video-player" /* TAG_TYPE.VIDEO_PLAYER */); | ||
if (canUse) { | ||
this.setData({ | ||
tagType: "video-player" /* TAG_TYPE.VIDEO_PLAYER */, | ||
videoPlayerCanPlay: false, | ||
isLoadingData: false, | ||
error: null, | ||
isHidden: false, | ||
}); | ||
this.updateCollector({ | ||
albumId, | ||
episodeId | ||
}); | ||
if (tt.canIUse("video-player" /* TAG_TYPE.VIDEO_PLAYER */)) { | ||
// albumId和episodeId 同时存在,且支持时,则渲染VIDEO_PLAYER | ||
videoTagType = "video-player" /* TAG_TYPE.VIDEO_PLAYER */; | ||
} | ||
else { | ||
this.setData({ | ||
tagType: "video" /* TAG_TYPE.VIDEO */, | ||
}); | ||
utils_1.VE_DEBUGGER.warn(`component video-player cannot support in current app version`); | ||
// 不支持渲染video | ||
videoTagType = "video" /* TAG_TYPE.VIDEO */; | ||
utils_1.VE_DEBUGGER.warn(`tagType: ${tagType} cannot support in current app version`); | ||
} | ||
} | ||
else if (currentSrc || tagType === "video" /* TAG_TYPE.VIDEO */) { | ||
// 如果有src,或者指定tagType为video,则渲染video | ||
videoTagType = "video" /* TAG_TYPE.VIDEO */; | ||
} | ||
else { | ||
this.setData({ | ||
tagType: "video" /* TAG_TYPE.VIDEO */, | ||
}); | ||
// 其他情况不渲染video | ||
videoTagType = "NO_RENDER" /* TAG_TYPE.NO_RENDER */; | ||
} | ||
this.setData({ videoTagType }); | ||
} | ||
}, | ||
methods: { | ||
onAidEidChange() { | ||
const { albumId, episodeId } = this.data; | ||
this.setData({ | ||
videoPlayerCanPlay: false, | ||
isLoadingData: false, | ||
error: null, | ||
isHidden: false, | ||
}); | ||
this.updateCollector({ | ||
albumId, | ||
episodeId | ||
}); | ||
}, | ||
onTagTypeChange() { | ||
const { tagType } = this.data; | ||
onVideoTagTypeChange() { | ||
this.updateCollector({ | ||
isVideoPlayer: tagType === "video-player" /* TAG_TYPE.VIDEO_PLAYER */ | ||
isVideoPlayer: this.data.videoTagType === "video-player" /* TAG_TYPE.VIDEO_PLAYER */ | ||
}); | ||
@@ -100,0 +110,0 @@ }, |
@@ -27,3 +27,3 @@ "use strict"; | ||
exports.PKG = 'douyin'; | ||
exports.VERSION = '1.2.7-alpha.1'; | ||
exports.VERSION = '1.2.7-alpha.2'; | ||
/** | ||
@@ -87,2 +87,3 @@ * 控制栏状态枚举 | ||
TAG_TYPE["VIDEO_PLAYER"] = "video-player"; | ||
TAG_TYPE["NO_RENDER"] = "NO_RENDER"; | ||
})(TAG_TYPE = exports.TAG_TYPE || (exports.TAG_TYPE = {})); |
@@ -27,2 +27,7 @@ "use strict"; | ||
// }, | ||
// tag的类型,用来继承其他标签 | ||
// 支持的值 'video', 'video-player' | ||
tagType: { | ||
type: String, | ||
}, | ||
mode: { | ||
@@ -107,3 +112,4 @@ type: String, | ||
isHidden: true, | ||
tagType: "video" /* TAG_TYPE.VIDEO */, // tag的类型,用来继承其他标签, 支持的值 'video', 'video-player' | ||
videoTagType: "NO_RENDER" /* TAG_TYPE.NO_RENDER */, | ||
isAttached: false, | ||
}, | ||
@@ -117,6 +123,2 @@ observers: { | ||
// }, | ||
componentId: function () { | ||
// componentId变化时则重新设置videoContext | ||
this.setVideoContext(); | ||
}, | ||
seeking: function (flag) { | ||
@@ -143,2 +145,8 @@ this._emitEvt(flag ? index_1.MediaEvents.SEEKING : index_1.MediaEvents.SEEKCOMPLETE, {}); | ||
}, | ||
'videoTagType': function () { | ||
// videoTagType变化时,重新设置videoContext | ||
if (this.data.isAttached) { | ||
this.setVideoContext(); | ||
} | ||
}, | ||
'src,definitionList,playAuthToken,playDomain': function () { | ||
@@ -208,4 +216,2 @@ const { src, definitionList, playAuthToken, playDomain, isLoadingData, videoId, currentSrc } = this.data; | ||
var _a; | ||
// eslint-disable-next-line @typescript-eslint/no-this-alias | ||
const self = this; | ||
const { videoProps, isFullScreen } = this.data; | ||
@@ -217,4 +223,7 @@ const propsClassNames = ((_a = videoProps.className) === null || _a === void 0 ? void 0 : _a.split(' ')) || []; | ||
].filter((item) => !!item); | ||
this.setData({ classNames: classNames.join(' ') }); | ||
this.setVideoContext(); | ||
this.setData({ classNames: classNames.join(' '), isAttached: true }); | ||
if (!this.meida) { | ||
console.warn('>>>>', this.data); | ||
this.setVideoContext(); | ||
} | ||
}, | ||
@@ -270,3 +279,4 @@ /** | ||
setVideoContext() { | ||
const { videoId, componentId, tagType } = this.data; | ||
const { videoId, videoTagType } = this.data; | ||
const { componentId } = this.properties; | ||
let _videoId = videoId || componentId; | ||
@@ -278,5 +288,7 @@ if (!_videoId) { | ||
videoId: _videoId, | ||
// customControls: controls !== 'native', | ||
}); | ||
const isVideoPlayer = tagType === "video-player" /* TAG_TYPE.VIDEO_PLAYER */; | ||
const isVideoPlayer = videoTagType === "video-player" /* TAG_TYPE.VIDEO_PLAYER */; | ||
const videoCtx = tt.createVideoContext(_videoId, isVideoPlayer ? this.videoPlayer : this); | ||
// eslint-disable-next-line @typescript-eslint/no-this-alias | ||
const self = this; | ||
@@ -376,6 +388,5 @@ const videoProxyCtx = new Proxy(videoCtx, { | ||
const { errMsg, errNo } = e.detail; | ||
const { isLoadingData, currentSrc, allowNullSource, videoId } = this.data; | ||
const { tagType } = this.properties; | ||
const { isLoadingData, currentSrc, allowNullSource, videoId, videoTagType } = this.data; | ||
index_2.VE_DEBUGGER.log(videoId, 'onError', videoId, `isLoadingData:${isLoadingData} currentSrc:${!!currentSrc} allowNullSource:${allowNullSource} isReturn:${!currentSrc && (allowNullSource || isLoadingData)}`, e.detail); | ||
if (!currentSrc && (allowNullSource || isLoadingData) && tagType === "video" /* TAG_TYPE.VIDEO */) { | ||
if (!currentSrc && (allowNullSource || isLoadingData) && videoTagType === "video" /* TAG_TYPE.VIDEO */) { | ||
console.warn('The is unavailable [src] or [playAutoToken] for playback, please check~~'); | ||
@@ -458,3 +469,3 @@ return; | ||
ended: true, | ||
paused: false, | ||
paused: true, | ||
}; | ||
@@ -461,0 +472,0 @@ this.isReplay = true; |
@@ -45,6 +45,6 @@ "use strict"; | ||
else if (category === ErrorCategory.INDUSTRY) { | ||
const { errNo, errMsg } = originDetail || {}; | ||
const { errNo, errMsg, errLogId = '' } = originDetail || {}; | ||
mediaError = { | ||
code: errNo, | ||
message: errMsg, | ||
message: `${errMsg}; logId: ${errLogId}`, | ||
noticeNote: errNo === error_code_1.ErrorCodes.INDUSTRY_NO_NET ? '服务或者网络错误' : '剧集未上架', | ||
@@ -51,0 +51,0 @@ }; |
{ | ||
"name": "veplayer-mp-douyin", | ||
"version": "1.2.7-alpha.1", | ||
"version": "1.2.7-alpha.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "miniprogramType": "tt-npm", |
Sorry, the diff of this file is not supported yet
163618
3074