veplayer-mp-douyin
Advanced tools
Comparing version 1.2.3-alpha.12 to 1.2.3-alpha.13
@@ -11,2 +11,3 @@ "use strict"; | ||
const enums_1 = require("../enums"); | ||
const utils_1 = require("../utils"); | ||
exports.default = Behavior({ | ||
@@ -43,4 +44,24 @@ properties: { | ||
playerStyle: '', | ||
// 可否可使用video以外的其他tagType | ||
canUseOtherType: true, | ||
// video-player是否已经触发过getsource可以播放 | ||
videoPlayerCanPlay: false, | ||
}, | ||
lifetimes: { | ||
attached() { | ||
const { tagType } = this.properties; | ||
let canUse = true; | ||
if (tagType !== "video" /* TAG_TYPE.VIDEO */) { | ||
// 如果不能使用指定的tagType,则降级成video | ||
canUse = tt.canIUse(tagType); | ||
if (!canUse) { | ||
console.warn(`tagType: ${tagType} cannot support in current app version`); | ||
} | ||
} | ||
this.setData({ | ||
canUseOtherType: canUse, | ||
}); | ||
utils_1.VE_DEBUGGER.log('canUseOtherType', canUse, this.properties.tagType); | ||
console.warn('behaviors attached'); | ||
}, | ||
ready() { | ||
@@ -53,3 +74,3 @@ // TODO video-player有bug,css百分比宽高不能生效,只能通过style固定值设置,等后续bug修复后去掉该函数调用 | ||
'albumId, episodeId': function () { | ||
this._videoPlayerCanPlay = false; | ||
this.setData({ videoPlayerCanPlay: false }); | ||
} | ||
@@ -59,3 +80,3 @@ }, | ||
onGetSource(e) { | ||
this._videoPlayerCanPlay = true; | ||
this.setData({ videoPlayerCanPlay: true }); | ||
this._emitEvt(enums_1.MediaEvents.GETSOURCE, e); | ||
@@ -62,0 +83,0 @@ }, |
@@ -17,3 +17,3 @@ "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.VERSION = exports.PKG = exports.PlayerModes = void 0; | ||
exports.TAG_TYPE = 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 */ | ||
@@ -28,3 +28,3 @@ __exportStar(require("./events"), exports); | ||
exports.PKG = 'douyin'; | ||
exports.VERSION = '1.2.3-alpha.12'; | ||
exports.VERSION = '1.2.3-alpha.13'; | ||
/** | ||
@@ -84,1 +84,6 @@ * 控制栏状态枚举 | ||
}; | ||
var TAG_TYPE; | ||
(function (TAG_TYPE) { | ||
TAG_TYPE["VIDEO"] = "video"; | ||
TAG_TYPE["VIDEO_PLAYER"] = "video-player"; | ||
})(TAG_TYPE = exports.TAG_TYPE || (exports.TAG_TYPE = {})); |
@@ -110,2 +110,3 @@ "use strict"; | ||
loading: true, | ||
// playAuthToken 数据请求时的状态 | ||
isLoadingData: true, | ||
@@ -116,4 +117,2 @@ showPoster: false, | ||
customControls: false, | ||
// 可否可使用video以外的其他tagType | ||
canUseOtherType: true, | ||
isHidden: true, // 是否隐藏video组件 | ||
@@ -215,14 +214,7 @@ }, | ||
var _a; | ||
console.warn('com attached'); | ||
const { componentId, tagType } = this.properties; | ||
let canUse = true; | ||
if (tagType !== 'video') { | ||
// 如果不能使用指定的tagType,则降级成video | ||
canUse = tt.canIUse(tagType); | ||
if (!canUse) { | ||
console.warn(`tagType: ${tagType} cannot support in current app version`); | ||
} | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-this-alias | ||
const self = this; | ||
const { videoId, videoProps, isFullScreen } = this.data; | ||
const { videoId, videoProps, isFullScreen, canUseOtherType } = this.data; | ||
// const { controls } = this.properties | ||
@@ -237,3 +229,4 @@ let _videoId = videoId || componentId; | ||
}); | ||
const videoCtx = tt.createVideoContext(_videoId, tagType === 'video' ? this : this.videoPlayer); | ||
const isVideoPlayer = tagType === "video-player" /* TAG_TYPE.VIDEO_PLAYER */ && canUseOtherType; | ||
const videoCtx = tt.createVideoContext(_videoId, isVideoPlayer ? this.videoPlayer : this); | ||
const propsClassNames = ((_a = videoProps.className) === null || _a === void 0 ? void 0 : _a.split(' ')) || []; | ||
@@ -264,4 +257,5 @@ const classNames = [ | ||
}); | ||
if (tagType === 'video-player') { | ||
if (self._videoPlayerCanPlay) { | ||
const { videoPlayerCanPlay } = self.data; | ||
if (isVideoPlayer) { | ||
if (videoPlayerCanPlay) { | ||
playFn(); | ||
@@ -271,3 +265,2 @@ } | ||
self.media.once(index_1.MediaEvents.GETSOURCE, () => { | ||
self._videoPlayerCanPlay = true; | ||
playFn(); | ||
@@ -291,7 +284,3 @@ }); | ||
index_3.default.setMedia(_videoId, this.media); | ||
index_2.VE_DEBUGGER.log('canUseOtherType', canUse, this.properties.tagType); | ||
this.setData({ | ||
classNames: classNames.join(' '), | ||
canUseOtherType: canUse, | ||
}); | ||
this.setData({ classNames: classNames.join(' ') }); | ||
}, | ||
@@ -298,0 +287,0 @@ /** |
{ | ||
"name": "veplayer-mp-douyin", | ||
"version": "1.2.3-alpha.12", | ||
"version": "1.2.3-alpha.13", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "miniprogramType": "tt-npm", |
Sorry, the diff of this file is not supported yet
160865
3019