Static p5_sys::global::createVideo[][src]

pub static createVideo: CreateVideoInternalType
Expand description

Creates an HTML5 video element in the DOM for simple playback of audio/video. Shown by default, can be hidden with .hide() and drawn into canvas using image(). The first parameter can be either a single string path to a video file, or an array of string paths to different formats of the same video. This is useful for ensuring that your video can play across different browsers, as each supports different formats. See this page for further information about supported formats.

Examples

let vid;
function setup() {
  noCanvas();

  vid = createVideo(
    ['assets/small.mp4', 'assets/small.ogv', 'assets/small.webm'],
    vidLoad
  );

  vid.size(100, 100);
}

// This function is called when the video loads
function vidLoad() {
  vid.loop();
  vid.volume(0);
}

Parameters

src path to a video file, or array of paths for supporting different browsers

callback? callback function to be called upon ‘canplaythrough’ event fire, that is, when the browser can play the media, and estimates that enough data has been loaded to play the media up to its end without having to stop for further buffering of content