davidohayon669 / react-native-youtube

A <YouTube/> component for React Native.
MIT License
1.16k stars 472 forks source link

Handling RuntimeException thrown by YouTubeStandalonePlayer.getReturnedInitializationResult #515

Closed luizppa closed 1 year ago

luizppa commented 3 years ago

I've noticed that when you have more than one app that can launch a standalone player for YouTube, your app will present a dialog for you to choose which app do you wish to use. If you close the dialog without choosing an option, the YoutubeStandaloneModule throws a RuntimeException that is not handled by the lib causing the app to crash.

Therefore I've wrapped the block inside a try catch and rejected the promise if the runtime error occurs.

I also fixed a few type definitions.

zabojad commented 1 year ago

Thank you @luizppa for your PR! Can you please resolve the conflicts it has so that I merge it for the next version?

luizppa commented 1 year ago

@zabojad done!