Contents

photo

The renderable, image-bearing DOM element (either an image or a canvas) that the Player consumes to render itself to the screen.

Declaration

attribute HTMLImageElement,HTMLCanvasElement photo;

Discussion

If this property is not populated by an image or canvas, the Player cannot play or render.

You can provide a value for this property in one of several ways:

  • Set photoSrc to a string URL and wait for the resulting download and decode to complete, at which point the property is populated with the resulting image.

  • Set photoSrc to an ArrayBuffer and wait for the decode to complete, at which point the property is populated with the resulting image.

  • Set the property directly to a fully loaded HTMLImageElement (such that its complete property is true).

  • Set the property directly to an HTMLCanvasElement you have prepared, such that its backing store depicts the photo and that the photo is scaled properly.

Assigning this property directly causes photoSrc to be cleared and set back to null. Moreover, if photoSrc was recently assigned and a network request or asynchronous decoding is still happening; that activity is also canceled.

See Also

Instance Properties