This commit is contained in:
Feross Aboukhadijeh
2016-03-04 16:00:16 -08:00
parent 7a7656671e
commit 5f02b73616
2 changed files with 11 additions and 3 deletions

View File

@@ -1,11 +1,18 @@
module.exports = captureVideoFrame
function captureVideoFrame (video, format) {
if (typeof video === 'string') video = document.querySelector(video)
if (!video || video.nodeName !== 'VIDEO') {
if (typeof video === 'string') {
video = document.querySelector(video)
}
if (video == null || video.nodeName !== 'VIDEO') {
throw new Error('First argument must be a <video> element or selector')
}
if (format == null) format = 'png'
if (format == null) {
format = 'png'
}
if (format !== 'png' && format !== 'jpg' && format !== 'webp') {
throw new Error('Second argument must be one of "png", "jpg", or "webp"')
}

View File

@@ -13,6 +13,7 @@ function torrentPoster (torrent, cb) {
.reduce(function (a, b) {
return a.length > b.length ? a : b
})
var index = torrent.files.indexOf(file)
var server = torrent.createServer(0)