Skip to content
Merged
Changes from all commits
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
2 changes: 1 addition & 1 deletion extensions/lab/video-sprites.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Name: Video Sprites
// ID: videoSprites
// Description: Replace sprites with a live video feed. Compatible with Scratch Lab's Animated Text experiment.
// By: Staevski_G <https://scratch.mit.edu/users/Staevski_G/>
// By: Staevski_G <https://scratch.mit.edu/users/Gogoi-does-things/>
// License: MPL-2.0

(function (Scratch) {
Expand Down Expand Up @@ -116,7 +116,7 @@
* @returns {boolean} true if a frame was drawn
*/
const sampleVideoToWorkCanvas = (width, height, zoom) => {
const videoCanvas = videoDevice.getFrame({

Check warning on line 119 in extensions/lab/video-sprites.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Property 'getFrame' does not exist on type 'Video'.
format: "canvas",
});

Expand Down Expand Up @@ -209,7 +209,7 @@
return renderer._allSkins[costume.skinId] || null;
}

get size() {

Check warning on line 212 in extensions/lab/video-sprites.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Property 'size' in type 'VideoSpriteSkin' is not assignable to the same property in base type 'Skin'. Type 'number[]' is not assignable to type '[number, number]'. Target requires 2 element(s) but source may have fewer.
const parent = this._getParentSkin();
return parent ? parent.size : [0, 0];
}
Expand All @@ -227,7 +227,7 @@
updateSilhouette(scale) {
const parent = this._getParentSkin();
if (parent) {
parent.updateSilhouette(scale);

Check warning on line 230 in extensions/lab/video-sprites.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Expected 0 arguments, but got 1.
this._silhouette = parent._silhouette;
}
}
Expand All @@ -247,7 +247,7 @@
return parentTexture;
}

parent.updateSilhouette(scale);

Check warning on line 250 in extensions/lab/video-sprites.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Expected 0 arguments, but got 1.
const silhouette = parent._silhouette;
this._silhouette = silhouette;

Expand Down Expand Up @@ -321,7 +321,7 @@
}

if (!this._texture) {
this._texture = twgl.createTexture(gl, {

Check warning on line 324 in extensions/lab/video-sprites.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Property 'createTexture' does not exist on type 'object'.
auto: false,
wrap: gl.CLAMP_TO_EDGE,
});
Expand All @@ -336,7 +336,7 @@
gl.RGBA,
gl.RGBA,
gl.UNSIGNED_BYTE,
new ImageData(outData, width, height)

Check warning on line 339 in extensions/lab/video-sprites.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

No overload matches this call. Overload 1 of 2, '(sw: number, sh: number, settings?: ImageDataSettings): ImageData', gave the following error. Argument of type 'Uint8ClampedArray<ArrayBufferLike>' is not assignable to parameter of type 'number'. Overload 2 of 2, '(data: ImageDataArray, sw: number, sh?: number, settings?: ImageDataSettings): ImageData', gave the following error. Argument of type 'Uint8ClampedArray<ArrayBufferLike>' is not assignable to parameter of type 'ImageDataArray'. Type 'ArrayBufferLike' is not assignable to type 'ArrayBuffer'. Type 'SharedArrayBuffer' is not assignable to type 'ArrayBuffer'. Types of property '[Symbol.toStringTag]' are incompatible. Type '"SharedArrayBuffer"' is not assignable to type '"ArrayBuffer"'.
);
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);

Expand All @@ -352,7 +352,7 @@
if (!state.skin) {
const id = renderer._nextSkinId++;
state.skin = new VideoSpriteSkin(id, target);
renderer._allSkins[id] = state.skin;

Check warning on line 355 in extensions/lab/video-sprites.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Type 'VideoSpriteSkin' is not assignable to type 'Skin'. Types of property 'size' are incompatible. Type 'number[]' is not assignable to type '[number, number]'. Target requires 2 element(s) but source may have fewer.
}

renderer.updateDrawableSkinId(target.drawableID, state.skin.id);
Expand Down Expand Up @@ -395,10 +395,10 @@
let hidPreview = false;
const ensureCamera = async () => {
try {
await videoDevice.enableVideo();

Check warning on line 398 in extensions/lab/video-sprites.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Property 'enableVideo' does not exist on type 'Video'.
if (!hidPreview) {
hidPreview = true;
videoDevice.setPreviewGhost(100);

Check warning on line 401 in extensions/lab/video-sprites.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

Property 'setPreviewGhost' does not exist on type 'Video'.
}
return true;
} catch (error) {
Expand All @@ -419,7 +419,7 @@

// If another script override the costume, switch it back to the video sprite one.
const drawable = renderer._allDrawables[target.drawableID];
if (drawable && drawable.skin !== skin) {

Check warning on line 422 in extensions/lab/video-sprites.js

View workflow job for this annotation

GitHub Actions / type-warnings

Type warning - may indicate a bug - ignore if no bug

This comparison appears to be unintentional because the types 'Skin' and 'VideoSpriteSkin' have no overlap.
renderer.updateDrawableSkinId(target.drawableID, skin.id);
}

Expand Down
Loading