Please provide the following:
- SDK Version: 49.0.3
- Platforms(Android/iOS/web/all): IOS
Hey guys I am pretty new at this and I am having a problem with the expo audio. I have even copied the example code from the docs and I am getting the same error.
I am just using it with expo go. If I open it in the web it works ok but if I open on my iPhone it doesnt work.
The error that i get is Possible Unhandled promise rejection
Type Error: right operand of ‘in’ is not an object
promiseRejectionTrackingOptions.js (45:14)
Can anyone help me get it working?
import React from "react";
import { View, Text, Button } from "react-native";
import { Audio } from "expo-av";
import styles from "./nearbyjobs.style";
const Nearbyjobs = () => {
const [sound, setSound] = React.useState();
async function playSound() {
console.log("Loading Sound");
const { sound } = await Audio.Sound.createAsync(
"https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3"
);
setSound(sound);
console.log("Playing Sound");
await sound.playAsync();
}
React.useEffect(() => {
return sound
? () => {
console.log("Unloading Sound");
sound.unloadAsync();
}
: undefined;
}, [sound]);
return (
<View>
<Button title='Play Sound' onPress={playSound} />
</View>
);
};
export default Nearbyjobs;