audio-loopback-extension
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

audio-loopback-extension

Introduction

An agora Web SDK extension which loops back audio through WebRTC PeerConnection to workaround Chrome echo issues.

Usage

import AgoraRTC from 'agora-rtc-sdk-ng'
import {AudioLoopbackExtension} from 'audio-loopback-extension'

async function main(){
  extension = new AudioLoopbackExtension();
  AgoraRTC.registerExtensions([extension]);
  
  //...join logic from Agora Web SDK
  
  client.on('user-published',async (user,mediaType)=>{
    if(mediaType === 'audio'){
      const remoteAudioTrack = await client.subscribe(user,mediaType);
      const loopbackProcessor = extension.createProcessor();
      
      remoteAudioTrack.pipe(loopbackProcessor).pipe(remoteAudioTrack.processorDestination);
    }
  });
}

if audio-loopback-extension is used along with other audio extensions, make sure audio-loopback-processor is last processor inside the processing pipeline.

In another words audio-loopback-processor MUST pipe to remoteAudioTrack.processorDestination.

let audioProcessorA;
let audioLoopbackProcessor;

remoteAudioTrack.pipe(audioProcessorA).pipe(audioLoopbackProcessor).pipe(remoteAudioTrack.processorDestination);

Readme

Keywords

none

Package Sidebar

Install

npm i audio-loopback-extension

Weekly Downloads

0

Version

1.0.4

License

ISC

Unpacked Size

729 kB

Total Files

9

Last publish

Collaborators

  • nealoveyou