/** * Configuration options for the audio mixer */ export interface AudioMixerConfig { /** Gain level for the background music (0.0 to 1.0) */ musicGain?: number; /** Duration of fade transition when changing music (in milliseconds) */ fadeDuration?: number; } /** * Represents an active audio mixing session */ export interface AudioMixerSession { /** The output MediaStream containing mixed audio and optional video */ outputStream: MediaStream; /** Update the background music gain (0.0 to 1.0) */ setMusicGain: (gain: number) => void; /** Change the background music with optional fade transition */ changeMusic: (musicUrl: string, withFade?: boolean) => Promise; /** Stop the background music with optional fade out */ stopMusic: (withFade?: boolean) => Promise; /** Completely cleanup and stop the mixing session */ cleanup: () => void; } /** * Create an audio mixing session that combines a MediaStream with background music. * The input stream's audio is kept at maximum gain, while the music gain is configurable. * Any video tracks from the input stream are preserved in the output. * * @param inputStream - MediaStream containing at least one audio track (and optionally video) * @param musicUrl - Optional URL or path to the MP3 music file. If not provided, the mixer is transparent. * @param config - Configuration options (musicGain defaults to 0.5, fadeDuration to 1000ms) * @returns AudioMixerSession with the output stream and control methods * * @example * ```typescript * // Create a transparent mixer (no music initially) * const session = await createAudioMixer(userMediaStream); * * // Or start with music * const session = await createAudioMixer( * userMediaStream, * 'background-music.mp3', * { musicGain: 0.3, fadeDuration: 2000 } * ); * * // Use the mixed output * videoElement.srcObject = session.outputStream; * * // Start or change music with fade (default) * await session.changeMusic('new-song.mp3'); * * // Change music without fade (instant switch) * await session.changeMusic('another-song.mp3', false); * * // Adjust volume * session.setMusicGain(0.5); * * // Stop music with fade (default) * await session.stopMusic(); * * // Stop music instantly * await session.stopMusic(false); * * // Cleanup when done * session.cleanup(); * ``` */ export declare function createAudioMixer(inputStream: MediaStream, musicUrl?: string, config?: AudioMixerConfig): Promise; //# sourceMappingURL=audioMixer.d.ts.map