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 module.exports = captureVideoFrame
function captureVideoFrame (video, format) { function captureVideoFrame (video, format) {
if (typeof video === 'string') video = document.querySelector(video) if (typeof video === 'string') {
if (!video || video.nodeName !== 'VIDEO') { video = document.querySelector(video)
}
if (video == null || video.nodeName !== 'VIDEO') {
throw new Error('First argument must be a <video> element or selector') 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') { if (format !== 'png' && format !== 'jpg' && format !== 'webp') {
throw new Error('Second argument must be one of "png", "jpg", or "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) { .reduce(function (a, b) {
return a.length > b.length ? a : b return a.length > b.length ? a : b
}) })
var index = torrent.files.indexOf(file) var index = torrent.files.indexOf(file)
var server = torrent.createServer(0) var server = torrent.createServer(0)