article-demo | 前端进阶积累:http : //obkoro1.com/web_accumulate/
kandi X-RAY | article-demo Summary
kandi X-RAY | article-demo Summary
article-demo
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of article-demo
article-demo Key Features
article-demo Examples and Code Snippets
Community Discussions
Trending Discussions on article-demo
QUESTION
I have a simple sidebar which contains videos from JSON each video have an edit button, now when U click edit button a modal opens up containing a video.
Here is a working demo live demo without thumbanails
Now I want when user clicks edit it should display a video as it's now and automatically it should generate thumbnails from video.
Here is what I have tried so far:
HTML
...ANSWER
Answered 2019-Jun-23 at 00:58Your problem is that video
is a jQuery element, which does not have an addEventHandler
method. Instead use video.on('event', function)
.
Alternatively, you could get the html element using video[0].addEventHandler
Additional problems in your code come from mixing jQuery elements with base html ones. Namely that videoHeight
and videoWidth
are properties of the base element, and the base element needs to be passed to ctx.drawImage
.
QUESTION
I found some examples, where people used a canvas and javascript to take multiple screenshots of a running video. You can see these examples here or here.
The code sets a time interval, draws the current timeframe to a canvas and uses this to create a screenshot.
I am wondering if it would be possible to use a similar technique, to automatically create a kind of preview for chapters of the video. But this would require to grab a bunch of screenshots before the video started. I failed to implement this, so I would like to know, if it is at all possible.
I know that one could use pretaken screenshots for the chapters, but I wanted to automate this process.
Thanks in advance for your answers.
...ANSWER
Answered 2017-Jan-26 at 22:12This could be done in theory by jumping to specific times in the video (say every 10 seconds) using video.currentTime
, waiting for the frame to be available (using progress
events), drawing the frame to a canvas (canvas.drawImage
) and storing it in some way (say an array of images having image.src = canvas.toDataURL
).
However, this process will take time because at least the relevant parts of the video would need to be loaded in the browser so the frame could be grabbed. The video would not be playable during the process as it is being skipped to different frames.
This behavior is usually not acceptable, but it really depends on your specific use case.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install article-demo
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page