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

Function createVideoElement

tfjs-core/src/test_util.ts:195–214  ·  view source on GitHub ↗
(source: HTMLSourceElement)

Source from the content-addressed store, hash-verified

193
194/** Creates an HTMLVideoElement with autoplay-friendly default settings. */
195export function createVideoElement(source: HTMLSourceElement):
196 Promise<HTMLVideoElement> {
197 const video = document.createElement('video');
198 if ('playsInline' in video) {
199 // tslint:disable-next-line:no-any
200 (video as any).playsInline = true;
201 }
202 video.muted = true;
203 video.loop = true;
204 video.style.position = 'fixed';
205 video.style.left = '0px';
206 video.style.top = '0px';
207
208 video.preload = 'auto';
209 video.appendChild(source);
210 return new Promise(resolve => {
211 video.addEventListener('loadeddata', _ => resolve(video));
212 video.load();
213 });
214}
215
216export async function play(video: HTMLVideoElement) {
217 await video.play();

Callers 1

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…