-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] .getInfo() --> Crash #121
Comments
Hey @sayem314 Opened a PR that should address your issue: I haven't had the time to test it on import React, { useState, useEffect } from 'react';
import { Button, View, Text } from 'react-native';
import { default as SoundPlayer } from 'react-native-sound-player'
const App = () => {
const [isPlaying, setIsPlaying] = useState(false);
useEffect(() => {
SoundPlayer
.getInfo()
.then(a => console.log("yeay", a))
.catch(b => console.error("ney", b));
})
useEffect(() => {
SoundPlayer.loadUrl("https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3")
return () => SoundPlayer.stop();
}, []);
useEffect(() => {
if (isPlaying) {
SoundPlayer.play();
} else {
SoundPlayer.pause();
}
}, [isPlaying]);
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Home Screen</Text>
<Button
title={isPlaying ? "stop" : "play"}
onPress={() => setIsPlaying((isPlaying) => !isPlaying)}
/>
</View>
);
};
export default App; results in
|
Thanks, @PupoSDC for PR. I will test this soon on iOS and update you. |
On iOS build is failing. Here is a snippet of the log.
|
@johnsonsu we just bumped to the newest version and we are getting a very suspicious error: Could it be because of these changes? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When there are no media playing but you call
.getInfo()
the app crashes even with try/catch blocks. Returningnull
would make much more sense.Expected behavior
The app should never crash. An error should be catchable.
Platform
Just installed the module and only tested it on Android Emulator.
Additional context
The text was updated successfully, but these errors were encountered: