MCPcopy Index your code
hub / github.com/tensorflow/tfjs / setupFakeVideoStream

Function setupFakeVideoStream

tfjs-data/src/util/test_utils.ts:23–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21
22// Provide fake video stream
23export function setupFakeVideoStream() {
24 const width = 100;
25 const height = 200;
26 const canvasElement = document.createElement('canvas');
27 const ctx = canvasElement.getContext('2d');
28 ctx.fillStyle = 'rgb(1,2,3)';
29 ctx.fillRect(0, 0, width, height);
30 // tslint:disable-next-line:no-any
31 const stream = (canvasElement as any).captureStream(60);
32 navigator.mediaDevices.getUserMedia = async () => {
33 return stream;
34 };
35}
36
37export async function replaceHTMLVideoElementSource(
38 videoElement: HTMLVideoElement) {

Callers 2

readers_test.tsFile · 0.90

Calls 1

getContextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…