Skip to content

Instantly share code, notes, and snippets.

@stvnrynlds
Last active July 6, 2018 21:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stvnrynlds/e98d7888842a6529294fab6da8fb5d5c to your computer and use it in GitHub Desktop.
Save stvnrynlds/e98d7888842a6529294fab6da8fb5d5c to your computer and use it in GitHub Desktop.
Properties and methods of the HTML video element
/*
Sources:
- MDN: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement
- WHATWG: https://html.spec.whatwg.org/multipage/embedded-content.html#media-element
*/
// METHODS
video.load(); // Reload video; No args
video.play(); // Play video; No args
video.pause(); // Pause video; No args
// READ & WRITE
video.autoplay; // Boolean; begin playing when video is loaded
video.controls; // Boolean; set visibility for native controls
video.currentTime; // Integer in seconds (e.g. 12.5)
video.defaultMuted; // Boolean; set default value of muted property
video.defaultPlaybackRate; // Integer; set default playback rate; see playbackRate
video.loop; // Boolean; looped playback
video.muted; // Boolean; mute audio
video.playbackRate; // Integer; Set playback speed; Normal: 1.0 | Fast: 2.0 | Slow: 0.5 | Rewind: -1.0
video.playsinline; // Boolean; play video inline rather than fullscreen (iOS 10 support)
video.poster; // String URL of video placeholder image
video.preload; // String; 'none' | 'metadata' | 'auto'
video.src; // String URL of video resource
video.volume; // Silent: 0.0 | Loudest: 1.0
// READ ONLY
video.currentSrc; // String URL; current src being played
video.duration; // Integer in seconds (e.g. 12.5)
video.error; // Error: return object | No Error: return null
video.ended; // Boolean; true if currentTime == duration
video.networkState; // 0: no data | 1: no activity (done loading) | 2: loading | 3: no source
video.paused; // Boolean; true if video is paused
video.readyState; // 0: nothing ready | 1: metadata ready | 4: video ready
video.seeking; // Boolean; true if user is seeking
video.videoHeight; // Native video height in pixels
video.videoWidth; // Native video width in pixels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment