0

I have a website that has a variety of embedded YouTube videos. When a user pauses a given video I want a screenshot to be taken of the playing video. Now, I've taken many approaches in tackling this problem such as copying the video frame to canvas (this doesn't work because the videos are external to my site), and also through the use of FFMpeg, and FFMpeg-PHP. The latter two- although very powerful- also do not work as the given piece of media has to be hosted on my server.

I'm at my wits end about what to do as I've spent countless hours trying to do this, and I'm ready to accept defeat.

Any ideas?

Regards,

Andre.

drizzy
  • 139
  • 2
  • 15

2 Answers2

0

There's no supported method in the YouTube Player or Data API to take a screenshot of an arbitrary frame of a video.

Jeff Posnick
  • 53,580
  • 14
  • 141
  • 167
-1

I used the img.youtube.com/vi path to get the image. The function getScreen basically parses the youtube url and grabs the &v= argument to get the video id.

Since I use youtube.com/embed/ url format, then I had to rework the function a little to get the video id.

http://mistonline.in/wp/get-youtube-video-screenshot-using-simple-php-and-javascript/#

JacobRossDev
  • 367
  • 5
  • 9