veplayer-mp-wechat
Advanced tools
Comparing version 1.2.8-rc.0 to 1.2.8-rc.1
@@ -210,3 +210,3 @@ "use strict"; | ||
type: Boolean, | ||
} | ||
}, | ||
}, | ||
@@ -213,0 +213,0 @@ data: {}, |
@@ -27,3 +27,3 @@ "use strict"; | ||
exports.PKG = 'wechat'; | ||
exports.VERSION = '1.2.8-rc.0'; | ||
exports.VERSION = '1.2.8-rc.1'; | ||
/** | ||
@@ -30,0 +30,0 @@ * 控制栏状态枚举 |
@@ -60,2 +60,7 @@ "use strict"; | ||
}, | ||
// 进度条更新的频率 | ||
timeUpdateInterval: { | ||
type: Number, | ||
value: 400, | ||
}, | ||
}, | ||
@@ -175,2 +180,3 @@ data: { | ||
const { videoId, videoProps, isFullScreen } = this.data; | ||
this.throttleSetData = (0, index_3.throttle)(this.setData, this.properties.timeUpdateInterval, { leading: true }); | ||
// const { controls } = this.properties | ||
@@ -351,2 +357,3 @@ index_3.VE_DEBUGGER.log('MAIN', 'attached'); | ||
onTimeupdate(e) { | ||
var _a; | ||
const { seeking, paused, ended, loop } = this.data; | ||
@@ -367,3 +374,3 @@ const { currentTime, duration } = e.detail; | ||
} | ||
this.setData(data); | ||
(_a = this.throttleSetData) === null || _a === void 0 ? void 0 : _a.call(this, data); | ||
this._emitEvt(index_1.MediaEvents.TIMEUPDATE, e); | ||
@@ -392,3 +399,3 @@ }, | ||
const { buffered } = e.detail; | ||
this.setData({ | ||
this.throttleSetData({ | ||
buffered: buffered, | ||
@@ -395,0 +402,0 @@ bufferedTime: buffered * this.data.duration / 100, |
@@ -45,2 +45,7 @@ "use strict"; | ||
}, | ||
// 进度条更新的频率 | ||
timeUpdateInterval: { | ||
type: Number, | ||
value: 400, | ||
}, | ||
}, | ||
@@ -62,4 +67,5 @@ data: { | ||
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名 | ||
// created() {}, | ||
// attached () { }, | ||
attached() { | ||
this.throttleSetData = (0, index_2.throttle)(this.setData, this.properties.timeUpdateInterval, { leading: true }); | ||
}, | ||
ready() { | ||
@@ -78,2 +84,10 @@ this.dragStartTime = -1; | ||
}, | ||
observers: { | ||
played(v) { | ||
console.warn('played:', v, (new Date()).toTimeString()); | ||
}, | ||
buffered(v) { | ||
console.warn('buffered:', v, (new Date()).toTimeString()); | ||
}, | ||
}, | ||
methods: { | ||
@@ -86,3 +100,3 @@ onClick() { | ||
if (!this.data.isActive && !this.data.isSeeking) { | ||
this.setData({ | ||
this.throttleSetData({ | ||
played: playPercent, | ||
@@ -95,3 +109,3 @@ blockStyle: `left:${playPercent}%;`, | ||
if (this.data.duration !== duration) { | ||
this.setData({ | ||
this.throttleSetData({ | ||
duration, | ||
@@ -105,3 +119,3 @@ durationText: (0, index_2.format)(duration), | ||
// console.log('[progress]>_onProgress', buffered, bufferedTime) | ||
this.setData({ | ||
this.throttleSetData({ | ||
buffered, | ||
@@ -108,0 +122,0 @@ }); |
@@ -5,3 +5,3 @@ "use strict"; | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
const xgplayer_service_miniprogram_1 = require("xgplayer-service-miniprogram/index.js"); | ||
const xgplayer_service_miniprogram_1 = require("xgplayer-service-miniprogram"); | ||
const index_1 = require("../xgerror/index"); | ||
@@ -8,0 +8,0 @@ function serviceRequest(playAuthToken, playDomain) { |
@@ -34,3 +34,3 @@ "use strict"; | ||
} | ||
config.needET && (_data['event_verify_url'] = 'https://mcs.bytedance.net'); | ||
config.needET && (_data['event_verify_url'] = 'https://xxx.xx.xx'); | ||
config.log && (_data.log = config.log); | ||
@@ -37,0 +37,0 @@ wx.__COLLECTOR__.uploader.init(_data); |
@@ -17,3 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getTouch = exports.classNames = exports.format = exports.padStart = void 0; | ||
exports.throttle = exports.debounce = exports.getTouch = exports.classNames = exports.format = exports.padStart = void 0; | ||
/* eslint-disable no-magic-numbers */ | ||
@@ -93,1 +93,145 @@ /* eslint-disable @typescript-eslint/no-magic-numbers */ | ||
exports.getTouch = getTouch; | ||
function isObject(value) { | ||
const type = typeof value; | ||
return value !== null && (type === 'object' || type === 'function'); | ||
} | ||
function debounce(func, wait, options) { | ||
let lastArgs, lastThis, maxWait, result, timerId, lastCallTime; | ||
let lastInvokeTime = 0; | ||
let leading = false; | ||
let maxing = false; | ||
let trailing = true; | ||
// Bypass `requestAnimationFrame` by explicitly setting `wait=0`. | ||
const useRAF = (!wait && wait !== 0 && typeof global.requestAnimationFrame === 'function'); | ||
if (typeof func !== 'function') { | ||
throw new TypeError('Expected a function'); | ||
} | ||
wait = Number(wait) || 0; | ||
if (isObject(options)) { | ||
leading = !!options.leading; | ||
maxing = 'maxWait' in options; | ||
maxWait = maxing ? Math.max(Number(options.maxWait) || 0, wait) : maxWait; | ||
trailing = 'trailing' in options ? !!options.trailing : trailing; | ||
} | ||
function invokeFunc(time) { | ||
const args = lastArgs; | ||
const thisArg = lastThis; | ||
lastArgs = lastThis = undefined; | ||
lastInvokeTime = time; | ||
result = func.apply(thisArg, args); | ||
return result; | ||
} | ||
function startTimer(pendingFunc, wait) { | ||
if (useRAF) { | ||
window.cancelAnimationFrame(timerId); | ||
return window.requestAnimationFrame(pendingFunc); | ||
} | ||
return setTimeout(pendingFunc, wait); | ||
} | ||
function cancelTimer(id) { | ||
if (useRAF) { | ||
return window.cancelAnimationFrame(id); | ||
} | ||
clearTimeout(id); | ||
} | ||
function leadingEdge(time) { | ||
// Reset any `maxWait` timer. | ||
lastInvokeTime = time; | ||
// Start the timer for the trailing edge. | ||
timerId = startTimer(timerExpired, wait); | ||
// Invoke the leading edge. | ||
return leading ? invokeFunc(time) : result; | ||
} | ||
function remainingWait(time) { | ||
const timeSinceLastCall = time - lastCallTime; | ||
const timeSinceLastInvoke = time - lastInvokeTime; | ||
const timeWaiting = wait - timeSinceLastCall; | ||
return maxing | ||
? Math.min(timeWaiting, maxWait - timeSinceLastInvoke) | ||
: timeWaiting; | ||
} | ||
function shouldInvoke(time) { | ||
const timeSinceLastCall = time - lastCallTime; | ||
const timeSinceLastInvoke = time - lastInvokeTime; | ||
// Either this is the first call, activity has stopped and we're at the | ||
// trailing edge, the system time has gone backwards and we're treating | ||
// it as the trailing edge, or we've hit the `maxWait` limit. | ||
return (lastCallTime === undefined || (timeSinceLastCall >= wait) || | ||
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); | ||
} | ||
function timerExpired() { | ||
const time = Date.now(); | ||
if (shouldInvoke(time)) { | ||
return trailingEdge(time); | ||
} | ||
// Restart the timer. | ||
timerId = startTimer(timerExpired, remainingWait(time)); | ||
} | ||
function trailingEdge(time) { | ||
timerId = undefined; | ||
// Only invoke if we have `lastArgs` which means `func` has been | ||
// debounced at least once. | ||
if (trailing && lastArgs) { | ||
return invokeFunc(time); | ||
} | ||
lastArgs = lastThis = undefined; | ||
return result; | ||
} | ||
function cancel() { | ||
if (timerId !== undefined) { | ||
cancelTimer(timerId); | ||
} | ||
lastInvokeTime = 0; | ||
lastArgs = lastCallTime = lastThis = timerId = undefined; | ||
} | ||
function flush() { | ||
return timerId === undefined ? result : trailingEdge(Date.now()); | ||
} | ||
function pending() { | ||
return timerId !== undefined; | ||
} | ||
function debounced(...args) { | ||
const time = Date.now(); | ||
const isInvoking = shouldInvoke(time); | ||
lastArgs = args; | ||
// eslint-disable-next-line @typescript-eslint/no-this-alias | ||
lastThis = this; | ||
lastCallTime = time; | ||
if (isInvoking) { | ||
if (timerId === undefined) { | ||
return leadingEdge(lastCallTime); | ||
} | ||
if (maxing) { | ||
// Handle invocations in a tight loop. | ||
timerId = startTimer(timerExpired, wait); | ||
return invokeFunc(lastCallTime); | ||
} | ||
} | ||
if (timerId === undefined) { | ||
timerId = startTimer(timerExpired, wait); | ||
} | ||
return result; | ||
} | ||
debounced.cancel = cancel; | ||
debounced.flush = flush; | ||
debounced.pending = pending; | ||
return debounced; | ||
} | ||
exports.debounce = debounce; | ||
function throttle(func, wait, options) { | ||
let leading = true; | ||
let trailing = true; | ||
if (typeof func !== 'function') { | ||
throw new TypeError('Expected a function'); | ||
} | ||
if (options && isObject(options)) { | ||
leading = 'leading' in options ? !!options.leading : leading; | ||
trailing = 'trailing' in options ? !!options.trailing : trailing; | ||
} | ||
return debounce(func, wait, { | ||
leading, | ||
trailing, | ||
maxWait: wait, | ||
}); | ||
} | ||
exports.throttle = throttle; |
{ | ||
"name": "veplayer-mp-wechat", | ||
"version": "1.2.8-rc.0", | ||
"license": "MIT", | ||
"miniprogram": "dist", | ||
"description": "小程序播放器微信原生版", | ||
"version": "1.2.8-rc.1", | ||
"dependencies": { | ||
"eventemitter3": "^5.0.1", | ||
"xgplayer-service-miniprogram": "^0.5.0" | ||
"xgplayer-service-miniprogram": "0.5.1-0" | ||
}, | ||
"devDependencies": { | ||
"@byted/lux-core": "^1.3.0", | ||
"@byted/lux-cli": "^1.2.3" | ||
}, | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "TRANSFORM_TYPE=weapp gulp -f ../../scripts/gulp.file.ts --cwd .", | ||
"postinstall": "node postinstall.js", | ||
"postbuild": "lux release commit", | ||
"version:rc": "lux version --preid rc" | ||
"postinstall": "node postinstall.js" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
1
2
0
164214
62
3050
+ Addedxgplayer-service-miniprogram@0.5.1-0(transitive)
- Removedxgplayer-service-miniprogram@0.5.0(transitive)