question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to capture the video frame when video is paused?

See original GitHub issue

There is a simple tool capture-video-frame.

I can use this tool to capture the HTML5 video frame easily with native video tag.

but I don’t know how to capture video frame with react-player.

May you please give me a few hints or suggestions?

thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
cookpetecommented, Feb 27, 2018

Hey @johnking, you can get the <video> element using the getInternalPlayer() method.

Given a ReactPlayer component like this:

<ReactPlayer 
  ref={player => { this.player = player }}
  url="https://cdn.rawgit.com/mediaelement/mediaelement-files/4d21a042/big_buck_bunny.mp4" 
  config={{ file: { attributes: {
    crossorigin: 'anonymous'
  }}}}
/>

You can use captureVideoFrame like so:

const frame = captureVideoFrame(this.player.getInternalPlayer())

See working example on jsFiddle.

Notice the extra config to add the crossorigin attribute to the <video>. Your video server will also need to support CORS correctly otherwise you will see an error:

Failed to load http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://fiddle.jshell.net' is therefore not allowed access.

For more info: http://overengineer.net/enabling-cors-for-html5-video-element-screenshots

1reaction
Pieterismcommented, May 5, 2019

When I try this solution i always get following message:

captureVideoFrame is not defined no-undef

any suggestions what causes this and how to solve?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best way to capture paused video frame to canvas
As you can see in the fiddle you can play the video, and canvas updates, but if you pause the video, mouse scroll...
Read more >
How to grab a freeze-frame from a video - PCWorld
Pause the video, find the right frame, and snap the picture. ... You can easily grab a frame by capturing the image on...
Read more >
FREEZE FRAME - Match Your Video Length with Your Audio
Need to freeze a frame or a part of your video because your narration is longer than your screen recording ?With Camtasia's "Extend...
Read more >
Quick Tip: Creating Stills and Pauses in Resolve - PremiumBeat
Here are three methods you can use to get a still of your video footage to create a pause. 1. Freeze Frame. First,...
Read more >
How to get screen shot of a paused video - Google Support
Tap to open the video; Tap once again to make the controls visible; Tap the edit icon at the bottom; Tap on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found