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 audio profile remains 'In-Call' after Session disconnect #172

Open WakeUpMrWest opened 5 years ago

WakeUpMrWest commented 5 years ago

I've found that on my Android implementation of this plugin that after leaving a Session, the audio profile on my device remains in 'In-Call' mode, and pressing the physical volume buttons continue to adjust 'In-Call Volume'. This persists at least until the app is force closed, and in some cases will even remain until the device is restarted. I've tested this on a variety of devices, such as the Pixel 3XL and Note 9 (both Android 9) and an LG-X230 (Android 6.0).

I've noticed that every time the app attempts to call session.disconnect(), it throws an error " Only the original thread that created a view hierarchy can touch its views".

This is how a session is terminated:

disconnectCall () { 
    if (this.publisher) { 
      this.publisher.destroy()
      this.publisher = null
    }

   if (this.session) {
      this.session.disconnect()
      this.session = null
   }

I've tried a variety of the available functions, such as session.unpublish(publisher) and session.disconnect() but so far only the above implementation that seems to successfully kill the connection and remove all the video elements.

monica-santos commented 4 years ago

@WakeUpMrWest did you found a way to fix this behaviour? I'm facing this same issue