Skip to content

Commit b8c04eb

Browse files
author
Lauren McCarthy
authored
Merge pull request #1470 from mindofmatthew/texture-error
Console error in texture()
2 parents 78fe510 + e7261a1 commit b8c04eb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/webgl/material.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ p5.prototype.texture = function(){
118118
textureData = args[0].canvas;
119119
}
120120
//if param is a video
121-
else if (args[0] instanceof p5.MediaElement){
121+
else if (typeof p5.MediaElement !== 'undefined' &&
122+
args[0] instanceof p5.MediaElement){
122123
if(!args[0].loadedmetadata) {return;}
123124
textureData = args[0].elt;
124125
}
@@ -133,7 +134,8 @@ p5.prototype.texture = function(){
133134
}
134135
else {
135136
if(args[0] instanceof p5.Graphics ||
136-
args[0] instanceof p5.MediaElement){
137+
(typeof p5.MediaElement !== 'undefined' &&
138+
args[0] instanceof p5.MediaElement)){
137139
textureData = args[0].elt;
138140
}
139141
else if(args[0] instanceof p5.Image){

0 commit comments

Comments
 (0)