问题描述
我们如何在 React Native 中添加声音? 我正在使用下面的代码,但它总是给出错误= undefined 不是对象(评估“Howler._navigator.appVersion.match”)
。 我正在使用以下代码:(使用 howler 依赖项),我也尝试使用 "react-native-sound" 依赖项,但它给出了相同的错误。
import React from 'react';
import { StyleSheet,Text,View,Image,TouchableOpacity} from 'react-native';
import { Howler,Howl } from 'howler';
import a from '../../assets/audios/a.mp3';
const timePass=function (){
var sound = new Howl({
src: [a]
});
return <View>
<TouchableOpacity style={{}} activeOpacity={0.8} onPress={()=>sound.play()}>
<Text>Sound</Text>
</TouchableOpacity>
</View>
}
const style=StyleSheet.create({ });
export default timePass;```
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)