← Форум / HTML5 / Генерировать постер с помощью js
var video = document.createElement("video");
video.preload = "auto";
video.src = 'scr/to/file.mp4';
video.addEventListener('loadeddata', function() {
video.currentTime = 10;
}, false);
video.addEventListener('seeked', function() {
var c = document.createElement("canvas");
var ctx = c.getContext("2d");
c.width = 800;
c.height = 450;
ctx.drawImage(video, 0, 0, 800, 450);
Uppod({
m:"video",
uid:'videoplayer',
file:'scr/to/file.mp4',
poster:c.toDataURL(),
st:"uppodvideo"
});
}, false);
video.preload = "auto";
video.src = 'scr/to/file.mp4';
video.addEventListener('loadeddata', function() {
video.currentTime = 10;
}, false);
video.addEventListener('seeked', function() {
var c = document.createElement("canvas");
var ctx = c.getContext("2d");
c.width = 800;
c.height = 450;
ctx.drawImage(video, 0, 0, 800, 450);
Uppod({
m:"video",
uid:'videoplayer',
file:'scr/to/file.mp4',
poster:c.toDataURL(),
st:"uppodvideo"
});
}, false);
Calepsol | Ссылка на пост (Смотрели 1211) | 22.09.17 18:19 Ответить |
1 | Можно узнать?куда этот код вставлять?как он может быть рабочим?может этому коду чего-то ещё не хватает? (ответить) |
Оставить комментарий