razorRun / react-native-vlc-media-player

React native media player for video streaming and playing. Supports RTSP, RTMP and other protocols supported by VLC player
https://roshan.digital/
MIT License
350 stars 183 forks source link

iOS: EXC_BAD_ACCESS When Loading Video #42

Open zaptrem opened 3 years ago

zaptrem commented 3 years ago

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 .

Michael24884 commented 3 years ago

You get this crash because you did not set a proper url. Notice the missing // after the https

zaptrem commented 3 years ago

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).

Michael24884 commented 3 years ago

Could you provide the error from the Xcode side? There should be a lot more

zaptrem commented 3 years ago

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

zaptrem commented 3 years ago

@Michael24884 is there some other log output you were looking for that could point us in the right direction?

Michael24884 commented 3 years ago

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

zaptrem commented 3 years ago

@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?

Michael24884 commented 3 years ago

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

zaptrem commented 3 years ago

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!

ericscottmarquez commented 3 years ago

@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

zaptrem commented 3 years ago

@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

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.

lackeluck commented 2 years ago

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" :))

patrickmycore commented 1 year ago

this is how I solved this issue:

  1. I opened the iOS folder using Xcode.
  2. located the file "RCTVLCPlayer.m" at this path: Pods/Development Pods/react-native-vlc-media-player/
  3. 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.

Nirav1432 commented 2 months ago

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 .

@zaptrem i recently phased same issue in IOS 17 and more on so issue is with the url of rtsp://

  1. rtsp://educase:ttb123educase@157.10.249.132:554/cam/realmonitor?channel=8&subtype=0
  2. rtsp://admin1:camera@2023@182.48.201.69:554/Streaming/Channels/601

so above you can see 2 url's and 1st one is working fine in same device

so issue with second url is becuase of password of camera contain special character so if you remove @ from camera@2023 and then play video it will load so modiefied url should be like this (no special character should contain) rtsp://admin1:camera2023@182.48.201.69:554/Streaming/Channels/601