opentoktokbox

TokBox screen sharing audio is not working


I'm using the TokBox / OpenTok screen sharing API for web browser, and when publishing a screen I'm using "publishAudio: true", but the subscriber does not receive any audio. The subscriber does receive the screen video though.

Does anyone know how to solve this audio issue? I'm using Google Chrome on macOS Catalina.


Solution

  • I need see more of you concrete case code but i hope this can help you.

    You need to send the audioSource. Example:

    if (videoSource) { // in my case, i'm using null or 'screen'
      opts.videoSource = videoSource;
    }
    
    console.log('micStream getAudioTracks:');
    console.log(micStream.getAudioTracks());
    
    opts.audioSource = micStream.getAudioTracks()[0]; //you can choose you audio source
    const target = document.getElementById(targetId);
    
    const pub = OT.initPublisher(target, opts, err => {
      if (err) {
        console.log('err');
        reject(err);
      } else {
        console.log('resolve');
        resolve(pub);
      }
    });
    

    I