提交 2e759719 编写于 作者: D DCloud_LXH

fix(App): createInnerAudioContext

上级 b1fffbc9
import { extend } from '@vue/shared'
import { extend, capitalize } from '@vue/shared'
import {
API_CREATE_INNER_AUDIO_CONTEXT,
defineSyncApi,
......@@ -194,7 +194,7 @@ const onAudioStateChange = ({
audio.__timing = setInterval(() => {
const currentTime = audio.currentTime
if (currentTime !== oldCurrentTime) {
emit(audio, 'timeupdate' as any)
emit(audio, 'timeUpdate' as any)
}
}, 200)
} else if (state === 'pause' || state === 'stop' || state === 'error') {
......@@ -294,7 +294,9 @@ class InnerAudioContext implements UniApp.InnerAudioContext {
/**
* 事件监听
*/
_callbacks: Partial<Record<InnerAudioContextEvent, Array<Function>>>
_callbacks: Partial<
Record<InnerAudioContextEvent, Array<Function | undefined>>
>
/**
*
* @param id 当前Audio示例id
......@@ -432,9 +434,7 @@ function emit(
errMsg?: string,
errCode?: unknown
) {
const name = `on${
state[0].toUpperCase() + state.substr(1)
}` as InnerAudioContextEvent
const name = `on${capitalize(state)}` as InnerAudioContextEvent
audio._callbacks[name]!.forEach((callback) => {
if (typeof callback === 'function') {
callback(
......
......@@ -21,6 +21,8 @@ export * from './media/saveVideoToPhotosAlbum'
export * from './media/saveImageToPhotosAlbum'
export * from './media/compressImage'
export * from './media/compressVideo'
export * from './media/chooseImage'
export * from './media/chooseVideo'
export * from './keyboard/keyboard'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册