, xHtml 1.0 HTML5.
jQuery : https://github.com/charlycoste/xhtml-video
: http://demo.ccoste.fr/video
, , HTML5, , , !
javascript , , <object>.
:
( ) , DOM:
var video = document.createElement('video');
canvas , DOM:
var canvas = document.createElement('canvas');
img DOM.
var img = document.createElement('img');
img.setAttribute('width', width);
img.setAttribute('height', height);
parent.appendChild(img);
(video.play()), ( , DOM, DOM xhtml 1.0)
canvas.getContext("2d").drawImage(video, 0, 0, width, height);
, toDataURL() canvas base64 src img.
img.setAttribute('src', canvas.toDataURL());
, javascript DOM img DOM. , HTML5 , HTML5.
Performance aspect: since this leads to a very intensive consumption process, playback may flicker ... To avoid this, you can reduce the rendering quality by using jpeg compression as follows: canvas.toDataURL('image/jpeg', quality)where qualityis the value between 0 and 1.
source
share