Skip to content

Commit c4dcb8f

Browse files
committed
fix the lint/test issue
1 parent 98160e5 commit c4dcb8f

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

src/dom/dom.js

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2303,7 +2303,7 @@ if (navigator.mediaDevices.getUserMedia === undefined) {
23032303
*
23042304
* The first parameter, `type`, is optional. It sets the type of capture to
23052305
* use. By default, `createCapture()` captures both audio and video. If `VIDEO`
2306-
* is passed, as in `createCapture(VIDEO)`, only video will be captured.
2306+
* is passed, as in `createCapture(VIDEO)`, only video will be cshould work with tintaptured.
23072307
* If `AUDIO` is passed, as in `createCapture(AUDIO)`, only audio will be
23082308
* captured. A constraints object can also be passed to customize the stream.
23092309
* See the <a href="http://w3c.github.io/mediacapture-main/getusermedia.html#media-track-constraints" target="_blank">
@@ -4955,22 +4955,23 @@ class MediaElement extends p5.Element {
49554955
this.setModified(true);
49564956
this._frameOnCanvas = this._pInst.frameCount;
49574957
}
4958+
} loadPixels(...args) {
4959+
this._ensureCanvas();
4960+
let renderer = null;
4961+
// Use the current p5 instance’s renderer if available
4962+
if (this._pInst && this._pInst._renderer) {
4963+
renderer = this._pInst._renderer;
4964+
} else if (typeof p5 !== 'undefined' && p5.instance && p5.instance._renderer) {
4965+
// Fallback for global mode
4966+
renderer = p5.instance._renderer;
4967+
} if (!renderer || typeof renderer.loadPixels !== 'function') {
4968+
throw new Error(
4969+
'p5 renderer not available in MediaElement.loadPixels()'
4970+
);
4971+
}
4972+
// Call renderer.loadPixels() but do NOT return anything
4973+
renderer.loadPixels(...args);
49584974
}
4959-
loadPixels(...args) {
4960-
this._ensureCanvas();
4961-
4962-
// ✅ use the current p5 instance’s renderer instead of global p5
4963-
if (this._pInst && this._pInst._renderer) {
4964-
return this._pInst._renderer.loadPixels(...args);
4965-
}
4966-
4967-
// fallback for old global mode (just in case)
4968-
if (typeof p5 !== 'undefined' && p5.Renderer2D && p5.Renderer2D.prototype) {
4969-
return p5.Renderer2D.prototype.loadPixels.apply(this, args);
4970-
}
4971-
4972-
throw new Error('p5 instance or renderer not available in MediaElement.loadPixels()');
4973-
}
49744975
updatePixels(x, y, w, h) {
49754976
if (this.loadedmetadata) {
49764977
// wait for metadata

0 commit comments

Comments
 (0)