testing/web-platform/tests/html/editing/dnd/media/001.xhtml
author Mozilla Releng Treescript <release+treescript@mozilla.org>
Wed, 25 May 2022 18:56:29 +0000
changeset 618847 fb0c469ac2fb9ed647bb174a047ea396f472adaf
parent 388141 f95a678186b46649eee6cf8c6adbdf46c320f300
permissions -rw-r--r--
no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD cy -> 18a3618fb08f9f3d0e6f5e3b4204193f154d6c98 es-AR -> d5f750233cd6e462d5170d396d5cd51f0ee64e81 eu -> 89eb1d19cbc2092da7c92305075e65b32cd4512d fi -> a4cac829965a4562b98df47ac5a5f3fe31a35fbf fr -> 906fdc5ffdd0eba897ab0796422a61e2d325640a fy-NL -> 5b22201eded974b72789b1974623023c84286948 it -> ed918e4ee4ab3b3f6f421c816eb4fcf32f76330f nl -> 52db668d98e87cff8c22b4448a50230aa05029b1 rm -> 12e718da5d7b059ba9dc4a18f56990a5adfc8658 ru -> 233a1c00ee183d01ca8592ddd3df434159ba1b8b

<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Video drag and drop</title>
<style type="text/css">
canvas
  {background-color:silver;}
</style>
<script type="application/ecmascript">
var draggedFrame = 'data:text/plain,FAIL';
function dropIt(event)
  {document.querySelector('p + p').firstChild.nodeValue = (draggedFrame == event.dataTransfer.getData('text/uri-list'))?'PASS':'FAIL';}
function start(event)
  {event.dataTransfer.effectAllowed = 'copy';
  var canvas = document.querySelector('canvas'),
  c = canvas.getContext('2d');
  c.drawImage(document.querySelector('video'),0,0,640,360);
  draggedFrame = canvas.toDataURL('image/png');
  event.dataTransfer.setData('text/uri-list',draggedFrame);}
</script>
<script src="/common/media.js"></script>
</head>
<body dropzone="copy string:text/uri-list" ondrop="dropIt(event)">
<p>
  <video draggable="true" ondragstart="start(event)" controls="true"/>
  <script>
    var video = document.querySelector('video');
    video.src = getVideoURI('/media/movie_5');
  </script>
</p>
<p>Drag video and drop it somewhere on the page. Dragged frame should be copied to the canvas below and you should see word PASS once you drop video.</p>
<p>
  <canvas width="640" height="360">Canvas</canvas>
</p>
</body>
</html>