From c5c2be75195321c089b7fcd1997ec278a7499ebf Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Tue, 16 Feb 2016 22:15:31 -0800 Subject: [PATCH] add torrent poster (screenshot) generation --- client/capture-video-frame.js | 23 ++++++++++++++++++ client/index.js | 45 ++++++++++++++++++++++------------- client/torrent-poster.js | 26 ++++++++++++++++++++ 3 files changed, 77 insertions(+), 17 deletions(-) create mode 100644 client/capture-video-frame.js create mode 100644 client/torrent-poster.js diff --git a/client/capture-video-frame.js b/client/capture-video-frame.js new file mode 100644 index 00000000..4cbd30a1 --- /dev/null +++ b/client/capture-video-frame.js @@ -0,0 +1,23 @@ +module.exports = captureVideoFrame + +function captureVideoFrame (video, format) { + if (typeof video === 'string') video = document.querySelector(video) + if (!video || video.nodeName !== 'VIDEO') { + throw new Error('First argument must be a