whenVideoReady

Type:Function
Status:stable
Since:1.0.0
Platform:js
@blackbyte.sugar.js.dom.when

Wait until the passed video is ready to play. It checks if the video metadata has been loaded, and if not it waits for the loadedmetadata event.

Params

  1. $video*-HTMLVideoElement

    The video to check the ready state

Return

  1. -Promise

    The promise that will be resolved when the video is ready to play

Example

import { whenVideoReady } from '@blackbyte/sugar/dom'
whenVideoReady($myCoolHTMLVideoElement).then(($video) => {
  // do something when the video is ready to play
});

Todo

  • testsnormal