:beetle: hello I implement this package for 2 devices android and ios, in Android no issue but when testing on Ios I have got an issue TypeError: onError is not a function. (In 'onError(error, props)', 'onError'
:beetle: after I observed the error message, I browsed to the package dir of the sound.js file and I found onError && onError(error, props); then I commented this error disappeared.
:beetle: myScript
import React, {useEffect} from 'react';
import {Text, View} from 'react-native';
import Sound from 'react-native-sound';
import dingSucces from './../assets/ringtone/game_success2.wav';
import dingFail from './../assets/ringtone/game_failed.mp3';
import dingGameOver from './../assets/ringtone/game_over.mp3';
Sound.setCategory('Playback');
const createSound = typeSound => {
return new Sound(typeSound, Sound.MAIN_BUNDLE, error => {
if (error) {
console.log('------failed to load the sound', error);
return;
}
// if loaded successfully
console.log(
'+++++duration in seconds: ' +
typeSound.getDuration() +
'number of channels: ' +
typeSound.getNumberOfChannels(),
);
});
};
var ding = createSound(dingSucces);
var dingFailled = createSound(dingFail);
var dingGameOv = createSound(dingGameOver);
export default function SoundEffect() {
const playPauseSucces = () => {
ding.play(success => {
if (success) {
console.log('successfully finished playing');
} else {
console.log('playback failed due to audio decoding errors');
}
});
};
const playPauseFailled = () => {
dingFailled.play(success => {
if (success) {
console.log('successfully finished playing');
} else {
console.log('playback failed due to audio decoding errors');
}
});
};
const playPauseGameOver = () => {
dingGameOv.play(success => {
if (success) {
console.log('successfully finished playing');
} else {
console.log('playback failed due to audio decoding errors');
}
});
};
return [playPauseSucces, playPauseFailled, playPauseGameOver];
}
:beetle: hello I implement this package for 2 devices android and ios, in Android no issue but when testing on Ios I have got an issue TypeError: onError is not a function. (In 'onError(error, props)', 'onError'
:beetle: after I observed the error message, I browsed to the package dir of the sound.js file and I found onError && onError(error, props); then I commented this error disappeared.
:beetle: myScript
Is your issue with...
Are you using...
react-native run-android
)Which versions are you using?
Does the problem occur on...
If your problem is happening on a device, which device?