Skip to content

[audio] Replace MediaSource for MediaProvider #721

@yanickrochon

Description

@yanickrochon

Describe The Problem To Be Solved

The property srcObject on HTMLAudioElement is of type MediaProvider, however the type for src in the audio package restricts only to a subset, that is MediaSource.

For example, this is perfectly valid:

const destination:MediaStreamAudioDestinationNode = context.createMediaStreamDestination();
const bufferSource:AudioBufferSourceNode = context.createBufferSource();
bufferSource.buffer = buffer;
bufferSource.start(0);
bufferSource.connect(context.destination);
state.player.srcObject = destination.stream satisfies MediaStream;

However, destination.stream is not a valid AudioSource according the declaration.

Suggest A Solution

Change

type AudioSource = string | undefined | HTMLAudioElement | MediaSource | (string & MediaSource);

to

type AudioSource = string | undefined | HTMLAudioElement | MediaProvider | (string & MediaProvider);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions