User may switch to different application pushing your RTC Application to Background and vice versa. You need to handle such activity using Enx.onPause() and Enx.onResume() methods.

Method: Enx.onPause(localMuteState, remoteMuteState)

Parameters:

  • localMuteState – Boolean. Pass false to pause local Video Stream, true to continue with publishing
  • remoteMuteState – Boolean. Pass false to pause receiving remote Video Stream, true to continue receiving

Method: Enx.onResume(localUnmuteState, remoteUnmuteState)

  • localUnmuteState – Boolean. Pass true to resume sending local Video Stream if it was stopped while getting to Background.
  • remoteUnmuteState – Boolean. Pass true to resume receiving remote Video Streams if they stopped while getting to Background.

// When application goes to Background 
this.setState({localMuteState : false});
this.setState({remoteMuteState : false}); 
Enx.onPause( localMuteState, remoteMuteState );   

// When application comes back to Foreground 
this.setState({localUnmuteState : true});
this.setState({remoteUnmuteState : true});  
Enx.onResume( localUnmuteState, remoteUnmuteState);