async function pollNextVideoColor(doWhilePolling, video, canvas) {
  canvas.getContext('2d').drawImage(video, 0, 0);
  const initialColor = getDominantCanvasColor(canvas);
  const resolver = new Resolver();
  function checkColor() {
    doWhilePolling();
    canvas.getContext('2d').drawImage(video, 0, 0);
    const color = getDominantCanvasColor(canvas);
    if (color != initialColor) {
      resolver.resolve(color);
      return;
    }
    setTimeout(checkColor, 0);
  }
  setTimeout(checkColor, 0);
  return resolver.promise;
}
/**
 * Polls the video's dominant color (see getDominantCanvasColor()) until a color
 * different than the initial color is retrieved, resolving the returned promise
 * with the new color name. The video color is read by drawing the video onto a
 * canvas and reading the color of the canvas. Before each time the color is
 * polled, doWhilePolling() is invoked.
 * @private
 */
Polls the video's dominant color ) until a color
different than the initial color is retrieved, resolving the returned promise
with the new color name. The video color is read by drawing the video onto a
canvas and reading the color of the canvas. Before each time the color is
polled, doWhilePolling() is invoked.
@private
Polls the video ' s dominant color ) until a color different than the initial color is retrieved resolving the returned promise with the new color name . The video color is read by drawing the video onto a canvas and reading the color of the canvas . Before each time the color is polled doWhilePolling () is invoked . @private
async function pollNextVideoColor(doWhilePolling, video, canvas) {
  canvas.getContext('2d').drawImage(video, 0, 0);
  const initialColor = getDominantCanvasColor(canvas);
  const resolver = new Resolver();
  function checkColor() {
    doWhilePolling();
    canvas.getContext('2d').drawImage(video, 0, 0);
    const color = getDominantCanvasColor(canvas);
    if (color != initialColor) {
      resolver.resolve(color);
      return;
    }
    setTimeout(checkColor, 0);
  }
  setTimeout(checkColor, 0);
  return resolver.promise;
}
async function pollNextVideoColor ( doWhilePolling , video , canvas ) { canvas . getContext ( '2d' ) . drawImage ( video , 0 , 0 ) ; const initialColor = getDominantCanvasColor ( canvas ) ; const resolver = new Resolver ( ) ; function checkColor ( ) { doWhilePolling ( ) ; canvas . getContext ( '2d' ) . drawImage ( video , 0 , 0 ) ; const color = getDominantCanvasColor ( canvas ) ; if ( color != initialColor ) { resolver . resolve ( color ) ; return ; } setTimeout ( checkColor , 0 ) ; } setTimeout ( checkColor , 0 ) ; return resolver . promise ; }
Polls the video's dominant color (see getDominantCanvasColor()) until a color
 different than the initial color is retrieved, resolving the returned promise
 with the new color name.
Polls the video ' s dominant color ( see getDominantCanvasColor () ) until a color different than the initial color is retrieved resolving the returned promise with the new color name .