Skip to content

dyte-io/device-emulator

Repository files navigation

Logo

Device Emulator by Dyte

Dyte's browser media devices emulation toolkit
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents

About The Project

For a WebRTC based solution like Dyte, having integration tests that can test multi-user call with Audio/Video on is necessary. Part of the integration tests is the ability to attest different media behaviours.

These are not straightforward as Media devices are usually not available in virtualised / testing environments, these interfaces (getUserMedia) are a reflection of actual hardware connected to the device, and therefore it is difficult to test real world scenarios in a software test run.

Even if you have devices available, scenarios such as

  • A new microphone device is plugged in, does my application switch the input to the new device
  • How does my application handle hardware failure

become difficult to test automatically

Dyte's Device Emulator is a solution for the above problems. It provides ways to add, remove media devices and mimic specific real world behaviour. By using this emulation toolkit, QA engineers, developers, and testers can ensure that WebRTC applications deliver a consistent and high-quality user experience across different hardware setups.

Running locally

Install dependencies

npm i

Run the development server

npm run dev

NOTE: This demo app currently expects dyte authtokens for legacy reasons, while running locally you can just remove the part where the dyte sdk is initalized and run the commands you want to from the console

Usage

Adding a virtual device

navigator.mediaDevices.addEmulatedDevice('videoinput');

Failing a virtual device

navigator.mediaDevices.failDevice(deviceId, true);

Silencing a virtual device

navigator.mediaDevices.silenceDevice(deviceId, true);

Checkout the docs for complete guides and examples https://docs.dyte.io/community-packages/device-emulator

Built With

  • Canvas
  • MediaDevices interface
  • Typescript

Roadmap

See the open issues for a list of proposed features (and known issues).

Few upcoming features are:

  1. Use any video file as a feed instead of default video feed.
  2. Audio file support
  3. Browser-like constraints
  4. Custom device names

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated. Sincere thanks to all our contributors. Thank you, contributors!

You are requested to follow the contribution guidelines specified in CONTRIBUTING.md and code of conduct at CODE_OF_CONDUCT.md while contributing to the project 😄.

Support

Contributions, issues, and feature requests are welcome! Give a ⭐️ if you like this project!

License

Distributed under the Apache License, Version 2.0. See LICENSE for more information.

About

device-emulator is created & maintained by dyte, Inc. You can find us on Twitter - @dyte_io or write to us at dev [at] dyte.io.

The names and logos for Dyte are trademarks of dyte, Inc.

We love open source software! See our other projects and our products.