Converts a blob to an image.
Promise with the resulting image.
// example
blobToImage(blobg).then(image => {});
Renders an element in the given 2d context.
Element to draw in context.
2d context.
Source width.
Source height.
Destination width.
Destination height.
Destination x position.
Destination y position.
Value indicating whether to mirror the image before.
// example
const canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
const context = canvas.getContext('2d');
const element = document.getElementById('img')
drawElement(element, context, element.width, element.height, width, height, 0, 0, false);
Renders an element in the given 2d context.
Element to draw in context.
2d context.
Source width.
Source height.
Source x position.
Source y position.
Destination width.
Destination height.
Destination x position.
Destination y position.
Value indicating whether to mirror the image before.
// example
const canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
const context = canvas.getContext('2d');
const element = document.getElementById('img')
drawPartOfElement(element, context, false, element.width, element.height, 0, 0, width, height, 0, 0, false);
Renders a video element in the given 2d context.
Video to draw in context.
2d context.
Destination width.
Destination height.
Destination x position.
Destination y position.
Value indicating whether to mirror the image before.
// example
const canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
const context = canvas.getContext('2d');
const video = document.getElementById('video')
drawElement(video, context, width, height, 0, 0, false);
Gets all available devices.
Promise with list of available devices.
// example
getAvailableDevices().then(devices => {});
Gets the id for the given device name.
Device name.
Promise with device id if found. Error otherwise.
// example
getDeviceId('OBS Virtual Camera').then(id => {
startDevice(id, 1080, 1920).then(stream => {});
});
Starts the media stream.
Webcam identifier.
Webcam width.
Webcam height.
MediaStream object to display webcam content.
// example
getDeviceId('OBS Virtual Camera').then(id => {
startDevice(id, 1080, 1920).then(stream => {});
});
Generated using TypeDoc
Provides classes and functions related to the rendering process of different media.
Usage
Composition
Allows to create an image based on many media objects (images, videos, etc.).
Allows to record a stream.
Functions
Gets navigator media devices.
Gets navigator device id.
Starts a given device (user media).
Renders an element in a given 2d context.
Renders a part of an element in a given 2d context.
Renders a video in a given 2d context.
Converts a blob to an image.