diff --git a/lib/addons/p5.dom.js b/lib/addons/p5.dom.js index 191e89f9ef..7547248708 100644 --- a/lib/addons/p5.dom.js +++ b/lib/addons/p5.dom.js @@ -1752,6 +1752,40 @@ * * @property src * @return {String} src + * @example + *
+ * var ele; + * + * function setup() { + * background(250); + * + * //p5.MediaElement objects are usually created + * //by calling the createAudio(), createVideo(), + * //and createCapture() functions. + * + * //In this example we create + * //a new p5.MediaElement via createAudio(). + * ele = createAudio('assets/beat.mp3'); + * + * //We'll set up our example so that + * //when you click on the text, + * //an alert box displays the MediaElement's + * //src field. + * textAlign(CENTER); + * text("Click Me!", width/2, height/2); + * } + * + * function mouseClicked() { + * //here we test if the mouse is over the + * //canvas element when it's clicked + * if(mouseX >= 0 && mouseX <= width && + * mouseY >= 0 && mouseY <= height) { + * //Show our p5.MediaElement's src field + * alert(ele.src); + * } + * } + * + *
*/ Object.defineProperty(self, 'src', { get: function() {