AgoraIO / API-Examples-Web

224 stars 199 forks source link

AgoraRTCException: AgoraRTCError NOT_SUPPORTED: your browser does not support setting the audio output device #70

Closed vietdung97 closed 1 year ago

vietdung97 commented 1 year ago

Hi Agora Team, I'm implementing voice call feature using agora-rtc-sdk-ng. But when I changed the output device, the error happened. image Here is my code

import AgoraRTC from 'agora-rtc-sdk-ng';

const client = AgoraRTC.createClient({ codec: 'h264', mode: 'rtc' });

await client.join(process.env.AGORA_APP_ID as string, channel, token || null, uid);
const localAudio = await AgoraRTC.createMicrophoneAudioTrack();
await localAudio.setMuted(false);

await localAudio.setDevice(inputId);
await localAudio.setPlaybackDevice(outputId);
await client.publish([localAudio]);

Your device: Google Chrome Version 108.0.5359.125 (Official Build) (64-bit) Package: "agora-rtc-sdk-ng": "^4.15.1", "next": "13.0.3",

vietdung97 commented 1 year ago

When I remove this line: await localAudio.setPlaybackDevice(outputId); The new error occurred AgoraRTCException: AgoraRTCError EXCHANGE_SDP_FAILED: P2PConnection.connect failed; OperationError: Failed to execute 'setLocalDescription' on 'RTCPeerConnection': Failed to set local offer sdp: A BUNDLE group contains a MID='0' matching no m= section. image I think client.publish is having problems in https production, but on localhost:3000 that's work normally

plutoless commented 1 year ago

@vietdung97 for setPlaybackDevice, this api is no longer supported. For the second issue it looks like network issue, what kind of network are you in? does this demo work for you? https://webdemo.agora.io/

vietdung97 commented 1 year ago

@plutoless So I can't change the output (have to change it manually on the computer) and can only change the microphone in the code, right? For the second issue, I fixed this by upgrade version "next" to 13.1.1.

plutoless commented 1 year ago

@vietdung97 for playout you are right it's suggested to do it manually on the computer. i'm not sure what you mean by "can only change the microphone in the code"

vietdung97 commented 1 year ago

@plutoless thanks. I mean the function await localAudio.setDevice(inputId);