device-emulator icon indicating copy to clipboard operation
device-emulator copied to clipboard

Feature request: Allow custom media input

Open palashgo opened this issue 2 years ago • 4 comments

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

palashgo avatar Oct 01 '23 08:10 palashgo

Hi @palashgo

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

  • Could you please explain the expected flow for adding the custom audio/video?
  • Should those custom videos/audios work within the same session only, or are they going to be uploaded somewhere else?

SoldierCorp avatar Oct 01 '23 09:10 SoldierCorp

@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

palashgo avatar Oct 02 '23 11:10 palashgo

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?

SoldierCorp avatar Oct 02 '23 15:10 SoldierCorp

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

palashgo avatar Oct 05 '23 07:10 palashgo