dyte-io / device-emulator

Browser media devices emulation toolkit
https://device-emulator.vercel.app
Other
23 stars 3 forks source link

Feature request: Allow custom media input #13

Open palashgo opened 1 year ago

palashgo commented 1 year ago

Is your feature request related to a problem? Please describe. The emulated devices that the library creates contain synthetically generated media which is not configurable. Certain use case would require control over the media source

Describe the solution you'd like Allow users of the library to provide a custom video / audio file to be used as the media source instead

SoldierCorp commented 1 year ago

Hi @palashgo

I would like to contribute to your project. But I have a couple of questions first.

palashgo commented 1 year ago

@SoldierCorp

The API to add a device currently looks like this

navigator.mediaDevices.addEmulatedDevice('videoinput')

addEmulatedDevice(
        kind: MediaDeviceKind,
        capabilities?: EmulatedAudioDeviceCapabilities | EmulatedVideoDeviceCapabilities,
    )

Ideally we can modify the second parameter to be a generic configuration which will have capabilities and sourceUrl parameter

navigator.mediaDevices.addEmulatedDevice('videoinput', { 
    capabilities: ...,
    sourceUrl: "https://example.com/video.mp4" 
})

You don't have to deal with uploading the videos anywhere, the consumers of the library will handle that

SoldierCorp commented 1 year ago

Thank you @palashgo!

How about the changes for the UI like, where do you need the button to add that custom file, what the user should see after adding that custom file?

palashgo commented 1 year ago

How about the changes for the UI like, where do you need the button to add that custom file, what the user should see after adding that custom file?

The UI is just an example app, that's good to have but not essential for this feautre