Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions tfjs-core/src/ops/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,6 @@ function fromPixels_(
` or {data: Uint32Array, width: number, height: number}, ` +
`but was ${(pixels as {}).constructor.name}`);
}
if (isVideo) {
const HAVE_CURRENT_DATA_READY_STATE = 2;
if (isVideo &&
(pixels as HTMLVideoElement).readyState <
HAVE_CURRENT_DATA_READY_STATE) {
throw new Error(
'The video element has not loaded data yet. Please wait for ' +
'`loadeddata` event on the <video> element.');
}
}
// If the current backend has 'FromPixels' registered, it has a more
// efficient way of handling pixel uploads, so we call that.
const kernel = getKernel(FromPixels, ENGINE.backendName);
Expand Down
9 changes: 0 additions & 9 deletions tfjs-core/src/ops/from_pixels_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,6 @@ describeWithFlags('fromPixels', BROWSER_ENVS, () => {
document.body.removeChild(video);
}, 30_000 /* 30 seconds */);

it('fromPixels for HTMLVideoElement throws without loadeddata', async () => {
const video = document.createElement('video');
video.width = 1;
video.height = 1;
video.src = 'data:image/gif;base64' +
',R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
expect(() => tf.browser.fromPixels(video)).toThrowError();
});

it('throws when passed a primitive number', () => {
const msg = /pixels passed to tf.browser.fromPixels\(\) must be either/;
// tslint:disable-next-line:no-any
Expand Down