ilkkao / capture-video-frame Goto Github PK
View Code? Open in Web Editor NEWTake screenshots from a <video> element
License: MIT License
Take screenshots from a <video> element
License: MIT License
Love your library, nicely written :)
I've used this library a couple of times and found I've need to put some code that involves waiting for readyState === 4. Would be cool that code was part of this as a helper function.
I can make a PR if you let me know if I should use timeouts or promises?
unsupport videojs palyer to capture
Whenever I try a video that isn't .mp4 I get an error:
TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)'
But this works for .mp4 videos. Any idea whats going on here?
class Player extends React.Component {
constructor (props) {
super(props)
this.state = {
url: "https://www.youtube.com/watch?v=oZrA9nQuEOM",
playing: false,
image: null,
frames: [],
captureInterval: 10000,
isLoading: false,
result: 0
}
`....`
<ReactPlayer
ref={player => { this.player = player }}
url={this.state.url}
playing={this.state.playing}
width='320px'
height='180px'
config={{ file: { attributes: {
crossorigin: 'anonymous'
}}}}
/>
As I have seen in demo, I have set capture-video-frame.js file in my assets/js/capture-video-frame.js folder and I have load that js from index.js file. In browser I have check that js is load or not. And It's load fine.
I'm using your code in angular 4. And I got error like this.
ERROR TypeError: this.captureVideoFrame is not a function
When I remove this keyword from capturteVideoFrame , then it shows error with red underline.
The error message is this. -> Cannot find name 'captureVideoFrame'.
First of all pls pardon me as i'm a novice programmer.
When i run the code and log the value of frame, it seems that there is no data embedded within the frame. Am i missing something?
{blob: Blob, dataUri: "data:,", format: "png"}
blob
:
Blob {size: 0, type: ","}
dataUri
:
"data:,"
format
:
"png"
proto
:
Object
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.