User may switch to different application pushing your RTC Application to Background and vice versa. You need to handle such activity using the following methods:

Method:

stopVideoTracksOnApplicationBackground( localMuteState, remoteMuteState , successCallback, errorCallback )

Parameters:

  • @param {boolean} localMuteState – Boolean. Pass true to pause local Video Stream, false to continue with publishing
  • @param {boolean} remoteMuteState – Boolean. Pass true to pause receiving remote Video Stream, false to continue receiving
  • @param {CallableFunction} successCallback
  • @param {CallableFunction} errorCallback

Method:

startVideoTracksOnApplicationForeground( localUnMuteState, remoteUnMuteState , successCallback, errorCallback )

Parameters:

  • @param {boolean} localUnMuteState – Boolean. Pass true to resume sending local Video Stream if it was stopped while getting to Background.
  • @param {boolean} remoteUnmuteState – Boolean. Pass true to resume receiving remote Video Streams if they stopped while getting to Background.
  • @param {CallableFunction} successCallback
  • @param {CallableFunction} errorCallback
// To pause
window.EnxRtc.stopVideoTracksOnApplicationBackground(true,true,function
(data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function (err) {
console.log('Uh oh… error' + JSON.stringify(err));
});

// To Resume
window.EnxRtc.startVideoTracksOnApplicationForeground
(true,true,,function (data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function (err) {
console.log('Uh oh… error' + JSON.stringify(err));
});