Screen sharing using getDisplayMedia doesn't work on android

Hi @saghul @callmemonky ,
I have an issue when execute getDisplayMedia. When I try to implement getDisplayMedia, It shows dialog to start screen share. After I click start now, nothing happens. My code looks like this:

mediaDevices.getDisplayMedia({ video: true }).then(stream => {
                            console.log("Succeeded to get screen!");
                        }).catch(error => {
                            console.log("Failed to get screen!");

I’ve already implemented the foreground service. Any idea what’s wrong with my code? Thanks.

What is the error?


It returns nothing. I’ve already waited, but nothing executed.

Anything on adb logcat?


I found two error on logcat:

  1. No package ID ff found for ID 0xffffffff.
  2. E/libEGL: call to OpenGL ES API with no current context (logged once per thread)

@faizalmp You need a foreground service for the screensharing to work.

@faizalmp Use this package, @supersami/rn-foreground-service - npm
Use this medium article.

1 Like

Thank you, I will try It.

After I check It again, It is about my activity not send onActivityResult callback to reactcontext. Thank you @callmemonky @saghul