2.27.0 (March 21, 2023)
Changes
VideoTrack.addProcessor
now works on browsers that support OffscreenCanvas
as well as HTMLCanvasElement
. When used with
@twilio/video-processors v2.0.0, the Virtual Background feature will work on browsers that supports WebGL2. See VideoTrack.addProcessor and @twilio/video-processors v2.0.0 for details.
Example
import { createLocalVideoTrack } from 'twilio-video';
import { Pipeline, VirtualBackgroundProcessor } from '@twilio/video-processors';
const virtualBackgroundProcessor = new VirtualBackgroundProcessor({
pipeline: Pipeline.WebGL2,
// ...otherOptions
});
await virtualBackgroundProcessor.loadModel();
const videoTrack = await createLocalVideoTrack({
width: 640,
height: 480,
frameRate: 24
});
videoTrack.addProcessor(processor, {
inputFrameBufferType: 'video',
outputFrameBufferContextType: 'webgl2',
});