example.tsx
1import VideoSnapshot from 'video-snapshot';
2
3document.querySelector('input[type="file"]').addEventListener('change', onChange);
4
5const onChange = async (e) => {
6 const snapshoter = new VideoSnapshot(e.target.files[0]);
7 const previewSrc = await snapshoter.takeSnapshot();
8 const img = document.createElement('img');
9
10 img.src = previewSrc;
11
12 document.body.appendChild(img);
13};