Skip to content
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

Android 12 crash when user overscrolls (in a ScrollView) #216

Closed
eliaslecomte opened this issue Jan 12, 2022 · 11 comments
Closed

Android 12 crash when user overscrolls (in a ScrollView) #216

eliaslecomte opened this issue Jan 12, 2022 · 11 comments

Comments

@eliaslecomte
Copy link

eliaslecomte commented Jan 12, 2022

Describe the bug
When the YoutubePlayer is rendered inside a list (tested with ScrollView), and the user overscrolls this list, the app crashes, if the video is playing, but not visible on the screen.

This happens on Android 12 that has the new overscroll effect that stretches all list items https://www.youtube.com/watch?v=2kIBdet_IKE.

To Reproduce

  1. Wrap a inside a , at the bottom of a list
  2. Play the video, go up
  3. The video is playing but not visible to the user
  4. Overscroll up
  5. App crashes

Smartphone (please complete the following information):

  • Phone: Samsung S21 Ultra
  • Os: Android 10 12
  • react-native-youtube-iframe 2.2.2
  • react-native-webview 11.15.0

Additional context
Stacktrace:

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

Unknown

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

Build fingerprint: 'samsung/p3sxeea/p3s:12/SP1A.210812.016/G998BXXS3BULC:user/release-keys'
Revision: '22'
ABI: 'arm64'
Timestamp: 2022-01-12 15:38:27.422073217+0100
Process uptime: 23s
Cmdline: com.daikineurope.online.controller.debug
pid: 11079, tid: 11195, name: RenderThread  >>> com.daikineurope.online.controller.debug <<<
uid: 10456
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20
Cause: null pointer dereference
    x0  0000000000000000  x1  00000074a01dd39c  x2  0000000000000000  x3  0000000000000000
    x4  0000000000000078  x5  0000000000000438  x6  00000000000008d9  x7  0000000000000000
    x8  0000000000000000  x9  0000000000000000  x10 0000000000000000  x11 0000000200000004
    x12 0000000000000000  x13 000000749f91c488  x14 000000749fdac38c  x15 000000000000002e
    x16 00000074a93ab7d0  x17 00000074a94ecb40  x18 00000070e1ebc000  x19 0000000000000000
    x20 0000000000000000  x21 0000000000000000  x22 0000000000000000  x23 0000000000000000
    x24 0000000000000000  x25 0000000000000000  x26 0000000000000000  x27 0000000000000000
    x28 0000000000000000  x29 00000070e2e98bb0
    lr  000000749ff49f6c  sp  00000070e2e98bb0  pc  000000749fe65520  pst 0000000020001000
backtrace:
      #00 pc 0000000000665520  /system/lib64/libhwui.so (SkSurface::getCanvas()+16) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #01 pc 0000000000749f68  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::GLFunctorDrawable::onDraw(SkCanvas*)+1604) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #02 pc 000000000071a1f8  /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+88) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #03 pc 00000000009063a4  /system/lib64/libhwui.so (SkGpuDevice::drawDrawable(SkDrawable*, SkMatrix const*, SkCanvas*)+352) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #04 pc 0000000000727724  /system/lib64/libhwui.so (android::uirenderer::$_36::__invoke(void const*, SkCanvas*, SkMatrix const&) (.llvm.4217273137337334370)+128) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #05 pc 000000000056388c  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+3564) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #06 pc 0000000000562930  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::onDraw(SkCanvas*)+236) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #07 pc 00000000004df6f0  /system/lib64/libhwui.so (android::uirenderer::$_23::__invoke(void const*, SkCanvas*, SkMatrix const&) (.llvm.4217273137337334370)+84) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #08 pc 000000000056388c  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+3564) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #09 pc 0000000000562930  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::onDraw(SkCanvas*)+236) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #10 pc 00000000004df6f0  /system/lib64/libhwui.so (android::uirenderer::$_23::__invoke(void const*, SkCanvas*, SkMatrix const&) (.llvm.4217273137337334370)+84) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #11 pc 000000000056388c  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+3564) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #12 pc 0000000000562930  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::onDraw(SkCanvas*)+236) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #13 pc 00000000004df6f0  /system/lib64/libhwui.so (android::uirenderer::$_23::__invoke(void const*, SkCanvas*, SkMatrix const&) (.llvm.4217273137337334370)+84) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #14 pc 000000000056388c  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+3564) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #15 pc 0000000000562930  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::onDraw(SkCanvas*)+236) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #16 pc 00000000004df6f0  /system/lib64/libhwui.so (android::uirenderer::$_23::__invoke(void const*, SkCanvas*, SkMatrix const&) (.llvm.4217273137337334370)+84) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #17 pc 000000000056388c  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+3564) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #18 pc 0000000000562930  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::onDraw(SkCanvas*)+236) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #19 pc 00000000004df6f0  /system/lib64/libhwui.so (android::uirenderer::$_23::__invoke(void const*, SkCanvas*, SkMatrix const&) (.llvm.4217273137337334370)+84) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #20 pc 000000000056388c  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+3564) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #21 pc 0000000000562930  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::onDraw(SkCanvas*)+236) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #22 pc 00000000004df6f0  /system/lib64/libhwui.so (android::uirenderer::$_23::__invoke(void const*, SkCanvas*, SkMatrix const&) (.llvm.4217273137337334370)+84) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #23 pc 000000000056388c  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+3564) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #24 pc 0000000000562930  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::onDraw(SkCanvas*)+236) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #25 pc 00000000004df6f0  /system/lib64/libhwui.so (android::uirenderer::$_23::__invoke(void const*, SkCanvas*, SkMatrix const&) (.llvm.4217273137337334370)+84) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #26 pc 000000000056388c  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+3564) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #27 pc 0000000000562930  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::onDraw(SkCanvas*)+236) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #28 pc 00000000004df6f0  /system/lib64/libhwui.so (android::uirenderer::$_23::__invoke(void const*, SkCanvas*, SkMatrix const&) (.llvm.4217273137337334370)+84) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #29 pc 000000000056388c  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+3564) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #30 pc 0000000000566d24  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*) const+196) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #31 pc 00000000005ab1b8  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::SkiaPipeline::renderLayersImpl(android::uirenderer::LayerUpdateQueue const&, bool)+776) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #32 pc 00000000005a87a0  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::SkiaPipeline::renderFrame(android::uirenderer::LayerUpdateQueue const&, SkRect const&, std::__1::vector<android::sp<android::uirenderer::RenderNode>, std::__1::allocator<android::sp<android::uirenderer::RenderNode> > > const&, bool, android::uirenderer::Rect const&, sk_sp<SkSurface>, SkMatrix const&)+132) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #33 pc 00000000005a8308  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::SkiaOpenGLPipeline::draw(android::uirenderer::renderthread::Frame const&, SkRect const&, SkRect const&, android::uirenderer::LightGeometry const&, android::uirenderer::LayerUpdateQueue*, android::uirenderer::Rect const&, bool, android::uirenderer::LightInfo const&, std::__1::vector<android::sp<android::uirenderer::RenderNode>, std::__1::allocator<android::sp<android::uirenderer::RenderNode> > > const&, android::uirenderer::FrameInfoVisualizer*)+432) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #34 pc 0000000000616ac0  /system/lib64/libhwui.so (android::uirenderer::renderthread::CanvasContext::draw()+1116) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #35 pc 0000000000615730  /system/lib64/libhwui.so (_ZNSt3__110__function6__funcIZN7android10uirenderer12renderthread13DrawFrameTask11postAndWaitEvE3$_0NS_9allocatorIS6_EEFvvEEclEv$c1671e787f244890c877724752face20+596) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #36 pc 000000000062b12c  /system/lib64/libhwui.so (android::uirenderer::WorkQueue::process()+156) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #37 pc 000000000062ae98  /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+84) (BuildId: 7d72076455ca8e37c1b9d2a9886eceb2)
      #38 pc 00000000000120a8  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+260) (BuildId: a8e5883b039c6d018dc9ced53f79b1d0)
      #39 pc 0000000000011960  /system/lib64/libutils.so (thread_data_t::trampoline(thread_data_t const*)+404) (BuildId: a8e5883b039c6d018dc9ced53f79b1d0)
      #40 pc 00000000000b3090  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+264) (BuildId: dda896312b8ac9c639f6aeb0175b8a0a)
      #41 pc 00000000000528f4  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: dda896312b8ac9c639f6aeb0175b8a0a)
@eliaslecomte
Copy link
Author

eliaslecomte commented Jan 12, 2022

You can work around this by disabling overscroll: <ScrollView overScrollMode="never">.

@eliaslecomte eliaslecomte changed the title Android 12 crash when user overscrolls (in a ScrollView, FlatList) Android 12 crash when user overscrolls (in a ScrollView) Jan 12, 2022
@LonelyCpp
Copy link
Owner

right, this is an issue with react-native-webview.

I'll add this to the FAQs section on the documentation page. seems very similar to the navigation crash

@IjzerenHein
Copy link

The following solution worked for me to workaround this problem:

Link to suggested solution:
react-native-webview/react-native-webview#1915 (comment)

<YoutubePlayer
   ...
   webViewStyle={styles.webView}
/>


const styles = StyleSheet.create({
    webView: Platform.select({
        // Fix crash on Android devices that use overscroll.
        // The webview inside the youtubeplayer causes a crash when the
        // parent scrollview scrolled to the top or bottom and causes a
        // overscoll effect. Setting the opacity to 0.99 on Android
        // prevents this problem.
        // https://github.com/react-native-webview/react-native-webview/issues/1915#issuecomment-808869253
        android: { opacity: 0.99 },
        default: {},
    }),
});

@ahlun
Copy link

ahlun commented Jun 8, 2022

@IjzerenHein solution works to prevent crashing, but for some reason on certain android devices, setting the WebView opacity to 0.99 causes the entire web view to be hidden altogether. A solution I found that works to prevent crashing and still show the webview on all my test devices is by setting the the androidLayoutType of the WebView to software instead:

<YoutubePlayer
   ...
   webViewProps={{androidLayerType: 'software'}}
/>

@concuacon
Copy link

You can work around this by disabling overscroll: <ScrollView overScrollMode="never">.

Thank you, you save my day <3

@magrinj
Copy link

magrinj commented Dec 12, 2022

@IjzerenHein solution works to prevent crashing, but for some reason on certain android devices, setting the WebView opacity to 0.99 causes the entire web view to be hidden altogether. A solution I found that works to prevent crashing and still show the webview on all my test devices is by setting the the androidLayoutType of the WebView to software instead:

<YoutubePlayer
   ...
   webViewProps={{androidLayerType: 'software'}}
/>

It's fixing the crash for me thanks, the video is playing but I can't see the content it stay dark...
If I click on full-screen I can see the content

@PR-Here
Copy link

PR-Here commented Jul 5, 2023

<YoutubePlayer
...
webViewProps={{androidLayerType: 'software'}}
/>

Work for me

Thanks

@davortrifunov
Copy link

Did you manage to find a fix for the black screen?

@JereLima
Copy link

JereLima commented Sep 7, 2023

Did you manage to find a fix for the black screen?

Add a prop
webViewStyle={{ backgroundColor: 'transparent', opacity: 0.99 }}

Route in stack

<Stack.Screen
        name="TrainingVideo"
        component={TrainingVideo}
        options={{
          animation:'none', //<=
          headerTitle: 'Treinamento',
          headerTitleAlign: 'center'}} />

@Vashiru
Copy link

Vashiru commented Oct 24, 2023

This has just been fixed 3 weeks ago with the new release of react-native-webview v13.6.2. I'm runnin gon Expo 48 and React Native 71 (without Hermes) that comes with v11.26.0 by default, updating it to v13.6.2 didn't seem to have any issues.

All earlier solutions (bg transparant, opacity 0.99, layertype software) etc. fixed the crash for me, but the video remained black (OnePlus 8T). That also seems to have been fixed.

The pull request:
react-native-webview/react-native-webview#2874

The changelog of the webview release:
https://github.com/react-native-webview/react-native-webview/releases/tag/v13.6.2

The comment that made me find the pull request:
react-native-webview/react-native-webview#1915 (comment)

@LonelyCpp
Copy link
Owner

a few solutions are mentioned here : https://lonelycpp.github.io/react-native-youtube-iframe/navigation-crash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

11 participants