Open dblazeski opened 5 years ago
@dblazeski seems like XCDYouTubeKit haven't upgraded yet. I'll try to look how simple is his solution, in the meanwhile, you can offer a PR
@davidohayon669 Please take a look my PR for this issue. #408
@davidohayon669 Please take a look my PR for this issue. #408
Tried the PR on iOS 12 (simulator) and iOS 13, works great!
@thanhcuong1990 had to change your code a bit in bae6948ed77f2a0371b1ee9d38cb13756445f89a, the older implementation (MPMoviePlayer) was resolving the Promise on each dismissing of the player. Using the AVPlayer I'm not sure how to achieve that, there is no point in resolving the Promise only if the video actually finishes playing (which is what AVPlayerItemDidPlayToEndTimeNotification
is for) this might never happen with regular use.
If you can improve that implementation it would be great. My idea is to resolve with the promise when the playing is dismissed (The modal is dismissed) and reject if anything wrong happened between launching the modal and finishing playing the video (by dismissing the modal). AVPlayer errors should also dismiss the modal.
This change is now available in beta:
First, delete YTPlayerView* from the Xcode project resources folder. Then I did this, now it works:
yarn add react-native-youtube@2.0.0-beta.3
cd ios
pod deintegrate && pod install
react-native run-ios
When using
YouTubeStandaloneIOS
on iOS 13, the app crashes with error:MPMoviePlayerViewController is no longer available. Use AVPlayerViewController in AVKit.
Looks like MPMoviePlayerViewController was deprecated and completely removed on iOS 13.Example code:
Related issue?: https://github.com/0xced/XCDYouTubeKit/issues/157 https://github.com/0xced/XCDYouTubeKit/issues/157#issuecomment-208328872