Dynamically Embed Any YouTube Video

I’ve seen this exact thing done. I just can’t seem to figure it all out.

Lets say I am working on website.com

  1. What I would like to do is take any random youtube video url let’s say youtube.com/watch?v=kffacxfA7G4

  2. Have the user replace “youtube.com” in the url with “website.com

  3. Have the video play within website.com/watch?v=kffacxfA7G4

Thanks

do u want to redirect?

I want the video to play in an an embedded player within myexample.com, but pull the video to be played from the url.

example: myexample.com/watch=VIDEOID

Take any embed code from youtube, just make the video id to appear dynamic based on your VIDEOID parameter.

<iframe width=“425” height=“349” src=“http://www.youtube.com/embed/&lt;?php echo strip_tags($_REQUEST[‘VIDEOID’]); ?>” frameborder=“0” allowfullscreen></iframe>

website.com/watch.php?VIDEOID=kffacxfA7G4

With old embed code, there are some author restrictions not to play outside youtube. But now with this iframe embed code, most of the videos are working well.