opentok / cordova-plugin-opentok

Cordova Plugin for OpenTok - add webrtc video to your iOS or Android App
MIT License
30 stars 80 forks source link

Android Error: Only the original thread that created a view hierarchy can touch its views #134

Open dhavalgala opened 5 years ago

dhavalgala commented 5 years ago

Bug Report

Current behavior

Getting Error: Only the original thread that created a view hierarchy can touch its views when we disconnect from a session on an Android device. That leaves a black screen on the device.

Steps to reproduce

  1. Start the call from browser
  2. Join the same call from Android device
  3. Disconnect from Android device. This should throw an error
  4. Disconnecting from browser first and then disconnecting from Android device works perfectly fine, but not the other way round.
  5. The black screen only disappears when I open the recent apps screen and then again open the app.
mmubasher commented 5 years ago

@msach22 any thoughts on this please as I have this problem occurring in production builds

IvoPelayo commented 5 years ago

+1 on this. It happens from time to time, maybe you are calling session.unpublish or session.unsubscribe (on ngOnDestroy?), after session.disconnect() and this session is unable to remove the divs created by the native plugin.

using a timeout on session disconnect event helps a little

msach22 commented 5 years ago

Hi all, I just created a demo application and disconnect followed the reproduction steps and am able to disconnect properly without a crash. I'm using the following:

I am getting the following error: session exception: Cannot unsubscribe: An unknown Subscriber instance was passed into Session.unsubscribe()., but that seems to be a separate issue.