Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  test_seamless_looping_video.html   Sprache: HTML

 
 products/Sources/formale Sprachen/C/Firefox/dom/media/test/test_seamless_looping_video.html


<!DOCTYPE HTML>
<html>
<head>
<title>Seamless looping video canvas test</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="manifest.js"></script>
</head>
<canvas id="canvas"></canvas>
<video id="v"></video>
<script type="application/javascript">

/**
 * This test aims to check if the video is seamless looping by capturing the
 * image when loop happens. We use a video contains only white frames, so the
 * captured frame should always be a white frame. If looping is not seamless,
 * the captured frame would become a black frame.
 */
const WIDTH = 10, HEIGHT = 10;

add_task(async function testSeamlessLoopingVideoCanvas() {
  await SpecialPowers.pushPrefEnv({
    set: [
      ["media.seamless-looping-video", true],
    ],
  });

  info(`load video which only contains white frames`);
  let video = document.getElementById("v");
  video.loop = true;
  video.src = "white-short.webm";
  video.width = WIDTH;
  video.height = HEIGHT;
  await video.play();

  info(`setup canvas`);
  const cvs = document.getElementById("canvas");
  cvs.width = WIDTH;
  cvs.height = HEIGHT;

  info(`test seamless looping multiples times`);
  let MAX_LOOPING_COUNT = 10;
  for (let count = 0; count < MAX_LOOPING_COUNT; count++) {
    await once(video"seeking");
    assertPaintedFrameIsWhiteFrame();
    await once(video"seeked");
    ok(true, `the round ${count} of the seamless looping succeeds`);
  }
});

function assertPaintedFrameIsWhiteFrame() {
  info(`catpure image from video`);
  const cvs = document.getElementById("canvas");
  let context = cvs.getContext('2d');
  if (!context) {
    ok(false, "can't get 2d context");
  }

  context.drawImage(document.getElementById("v"), 0, 0, WIDTH, HEIGHT);
  let imageData = context.getImageData(0, 0, WIDTH, HEIGHT);
  for (let idx = 0; idx < WIDTH * HEIGHT; idx++) {
    let pixelCount = 4 * idx; // RGBA
    let data = imageData.data;
    // White frame's RGB value should be [255,255,255]
    is(data[pixelCount + 0], 255, `R should be 255`);
    is(data[pixelCount + 1], 255, `G should be 255`);
    is(data[pixelCount + 2], 255, `B should be 255`);
  }
}
</script>
<body>
</body>
</html>

Messung V0.5
C=96 H=95 G=95

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge