我正在使用null
在无限循环中播放小型音频剪辑,但是在当前循环结束与下一个循环开始之间有100-200毫秒的不必要的暂停。
声音之间的停顿时间很小,但让用户感到烦恼,因此有什么解决办法。
const list = [{"firstName":null,"lastName":"I.","country":"Argentina","continent":"Americas","age":35,"language":"Java"},{"firstName":"Lukas","lastName":"X.","country":"Croatia","continent":"Europe","age":35,"language":null},{"firstName":"Madison","lastName":"U.","country":"United States","continent":"Americas","age":32,"language":"Ruby"}]
const missingDetail = list.reduce((arr, item) => {
// find first null value entry
let [ missing ] = Object.entries(item).find(([ prop, val ]) => val === null) || []
if (missing) {
// missing contains the property name of the first null value
// push new item-with-question object to the final array
arr.push({
...item,
question: `Hi, could you please provide your ${missing}`
})
}
return arr
}, [])
console.info(missingDetail)
答案 0 :(得分:1)
我通过使用SoundPool而不是MediaPlayer解决了这个问题,
StackLayout