Svetlana Rozhkova
Svetlana Rozhkova

Reputation: 178

OpenTok publisher is unable to send stream video in background mode

There is a problem with openTok on Android. If app goes to background mode and stays in background for approximately 1 minute, publisher's view becomes black and publisher is unable to send stream video at subscriber side.

No errors in logs, publisher’s onError and onStreamDestroyed callbacks are not triggered as well.

OpenTok sdk version: 2.16.5, Android version: 9.0

The issue is reproduced on device with android version 9.0 but not reproduced on device with 7.1.2 version.

It seems to be a bug of OpenTok and the issue is very critical to our applications. Please help! Any solution would be highly appreciated!

Upvotes: 0

Views: 381

Answers (1)

Mayur Dhanrajani
Mayur Dhanrajani

Reputation: 72

@Override
protected void onStart() {
    super.onStart();
    if (publisher != null) {
        publisher.cycleCamera();
        publisher.cycleCamera();
    }
}

It's not the best solution but it's a working one. Every time your app comes to foreground, just switch the camera twice.

There won't be any camera switch transitions in the video, so it will look normal.

Upvotes: 2

Related Questions