react-native-vlc-media-player
                                
                                 react-native-vlc-media-player copied to clipboard
                                
                                    react-native-vlc-media-player copied to clipboard
                            
                            
                            
                        iOS: EXC_BAD_ACCESS When Loading Video
I'm loading a .mov video from a web server using the following code:
<VLCPlayer
                ref={ref => (this.vlcPlayer = ref)}
                style={[styles.video]}
                source={{ uri: this.state.videoURI }}
              />
When the component begins rendering, I get the following console output before the app crashes:
2020-11-06 03:27:02.378 [info][tid:com.facebook.react.JavaScript] 'Video: ', 'https://webserver.com/redirect-to-thing.mov'
2020-11-06 03:27:02.389540-0500 AppName[21333:4378578] creating player instance using shared library
2020-11-06 03:27:02.402159-0500 AppName[21333:4378578] autoplay: 1
The error is in libsystem_platform.dylib`_platform_strlen: "Thread 48: EXC_BAD_ACCESS (code=1, address=0x0)"
Tested on iOS 14.2 and 13.5. Xcode is 12.2. React Native is 0.62.2 .
You get this crash because you did not set a proper url. Notice the missing // after the https
You get this crash because you did not set a proper url. Notice the missing // after the https
Thanks for responding, but the URL is correct in my app. I replaced it when pasting the error for privacy reasons with that dummy url (which is where the mistake was introduced).
Could you provide the error from the Xcode side? There should be a lot more
Could you provide the error from the Xcode side? There should be a lot more
Here's all I have: https://imgur.com/a/YASQqOe
@Michael24884 is there some other log output you were looking for that could point us in the right direction?
Hey does this also occur for other URLs? You can try one of these public test links to see if it's just yours : Public Test Links
@Michael24884 Hardcoding the source to that seems to have gotten me a new error, which is progress, so thanks! However, I get no video and this log output:
2020-11-11 14:59:30.906248-0500 ReLearn[9745:2217662] creating player instance using shared library
2020-11-11 14:59:30.913882-0500 ReLearn[9745:2217662] autoplay: 1
2020-11-11 14:59:30.921814-0500 ReLearn[9745:2217662] userInfo (null)
2020-11-11 14:59:30.921855-0500 ReLearn[9745:2217662] standardUserDefaults <NSUserDefaults: 0x281881230>
2020-11-11 14:59:30.921864-0500 ReLearn[9745:2217662] VLCMediaPlayerStateBuffering 1
2020-11-11 14:59:31.149671-0500 ReLearn[9745:2217662] userInfo (null)
2020-11-11 14:59:31.149759-0500 ReLearn[9745:2217662] standardUserDefaults <NSUserDefaults: 0x281881230>
2020-11-11 14:59:31.181203-0500 ReLearn[9745:2217662] userInfo (null)
2020-11-11 14:59:31.181283-0500 ReLearn[9745:2217662] standardUserDefaults <NSUserDefaults: 0x281881230>
2020-11-11 14:59:31.181295-0500 ReLearn[9745:2217662] VLCMediaPlayerStateBuffering 1
2020-11-11 14:59:32.208650-0500 ReLearn[9745:2217662] userInfo (null)
2020-11-11 14:59:32.208720-0500 ReLearn[9745:2217662] standardUserDefaults <NSUserDefaults: 0x281881230>
2020-11-11 14:59:32.208730-0500 ReLearn[9745:2217662] VLCMediaPlayerStateBuffering 1
2020-11-11 14:59:32.478382-0500 ReLearn[9745:2217662] Metal GPU Frame Capture Enabled
2020-11-11 14:59:32.479782-0500 ReLearn[9745:2217662] Metal API Validation Enabled
2020-11-11 14:59:34.235516-0500 ReLearn[9745:2217662] userInfo (null)
2020-11-11 14:59:34.235643-0500 ReLearn[9745:2217662] standardUserDefaults <NSUserDefaults: 0x281881230>
2020-11-11 14:59:34.235660-0500 ReLearn[9745:2217662] VLCMediaPlayerStateBuffering 1
[h264 @ 0x13b882a00] get_buffer() failed
[h264 @ 0x13b882a00] thread_get_buffer() failed
[h264 @ 0x13b882a00] decode_slice_header error
[h264 @ 0x13b882a00] no frame!
<NOTE, THE LAST 4 LINES LOOP INFINITELY AFTERWARD>
Any idea what this could mean?
It's probably just the ffmpeg looking ahead into the video data. How are you laying out the component for the player? It might be due to the insufficient size
It's probably just the ffmpeg looking ahead into the video data. How are you laying out the component for the player? It might be due to the insufficient size
That's it. I had to explicitly set the size. Sorry about that, and thanks for the assistance!
@zaptrem did you just set the resize mode to fix this error? I'm having a similar issue with a blank screen when loading the react native component inside a <View />
@zaptrem did you just set the resize mode to fix this error? I'm having a similar issue with a blank screen when loading the react native component inside a <View />
I think I had to give it an explicit height and width pixel value. I switched back to Expo-AV months ago as we realized we had to do transcoding in the cloud anyway.
on IOS, I have same problem. I found, In my case, xcode will throw error EXC BAD ACCESS while video uri is "null" or undefined. I set uri default value is "abcxyzxxxx" :))
this is how I solved this issue:
- I opened the iOS folder using Xcode.
- located the file "RCTVLCPlayer.m" at this path:
Pods/Development Pods/react-native-vlc-media-player/
- commented out the lines 163, 164, and 165 in the file where the error was occurring.
Here is the modified content of Pods/Development Pods/react-native-vlc-media-player/RCTVLCPlayer.m:
// 163   //self.onVideoLoadStart(@{
// 164   //                     @"target": self.reactTag
// 165   //                   });
I understand that this may not be a proper solution, but it effectively resolved my problem. Initially, my app was crashing immediately on iOS but working fine on Android. After implementing these changes, my app now runs on both platforms.