Skip to content

Expose underlying audio tag #19

@Antonyesk601

Description

@Antonyesk601

Hey, is it possible to either modify the SDK so not only you expose the AudioContext but also the input MediaStreamTrack or at least attach the underlying audio HTML elements . Right now it's impossible to do any volume control or transformations on the agent.

  private handleAudioEvents(startCallConfig: StartCallConfig): void {
    this.room.on(
      RoomEvent.TrackSubscribed,
      (
        track: RemoteTrack,
        publication: RemoteTrackPublication,
        participant: RemoteParticipant,
      ) => {
        if (track.kind === Track.Kind.Audio) {
          if (
            publication.trackName === "agent_audio" &&
            track instanceof RemoteAudioTrack &&
            startCallConfig.emitRawAudioSamples
          ) {
            this.analyzerComponent = createAudioAnalyser(track);
            this.captureAudioFrame = window.requestAnimationFrame(() =>
              this.captureAudioSamples(),
            );
          }

          // Start playing audio
 /*CURRENT*/   
          track.attach(); // Currently in the sdk
 /*SUGGESTED*/ 
          document.body.append(track.attach()); // Exposes the underlying audio track for better control
        }
      },
    );
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions