import Sound from 'react-native-sound';import Tab from '../router/bottomTabNav';import {Button} from 'react-native';import mp3 from './Sound5/5.mp3';interface mp3 { mp3: mp3;}function AudioClock() {Sound.setCategory('Playback');const audioFile = new Sound((mp3), (error) => { if (error) { console.log('failed to load the sound', error); return; } // loaded successfully console.log('duration in seconds: '+ audioFile.getDuration() +'number of channels: '+ audioFile.getNumberOfChannels()); audioFile.setVolume(1);audioFile.setPan(1); audioFile.play((success) => { if (success) { console.log('successfully finished playing'); } else { console.log('playback failed due to audio decoding errors'); } });});<Button title="Say time" onPress={Tab} />}updated the asset.d.ts and tsconfig.json respectively declare module "*.mp3" { const value: any; export default value; }"include": ["src/*","types/*"
on click of Tab, no sound, if in the beginning i doconst audioFile = new Sound((Sound.mp3), (error) => {
instead of const audioFile = new Sound((mp3), (error) => {there is a mp3 type error. either way i know importing on typescript broken for audio but i thought this would work.
it's such simple functionality but so problematic in typescript it seems. i did leverage this code from an alarm clock function so let me know if anything suspect there, although i do see it as a wider. ts mp3 issue. lmk thanks