Opentok / Vonage screenshot sample for Android return solid green image

111 Views Asked by At

We tried the code sample provided by Opentok for capturing screenshot of publisher but it is not working. It returns solid green screen. Can some one please provide working code sample?

1

There are 1 best solutions below

0
user1871952 On

Can you try using the below code and let me know if you are able to take the publisher's snapshot?

(publisher?.view as TextureView).bitmap //captures publisher's snapshot

(subscriber?.view as TextureView).bitmap //captures subscriber's snapshot

To use the above, please make sure to enable textureView inside sessionOptions as below:-

session = Session.Builder(this, apiKey, sessionId).sessionOptions(object : Session.SessionOptions() {
            
            override fun useTextureViews(): Boolean {
                return true
            }
        }).build().also {
            it.setSessionListener(sessionListener)
            it.connect(token)
        }

Let me know how it goes.