Reformat a YouTube URL using jQuery

Posted by jamEs on Stack Overflow See other posts from Stack Overflow or by jamEs
Published on 2010-12-22T21:50:24Z Indexed on 2010/12/22 21:54 UTC
Read the original article Hit count: 316

Filed under:
|
|

I am using the YouTube Channel jQuery script to pull in data from a YouTube channel. Then I'm using an iFrame on the page to display the videos without leaving the site. The only problem is that the URLs the Channel plugin is pulling in don't quite work with my iFrame concept. They load the whole YouTube page instead of just the video. I figured out a workaround that basically I reformat the URL and tell it to display fullscreen and to autoplay will do what I would like it to do.

The URLs are currently formatted like

http://www.youtube.com/watch?v=xxxxxxxxx&feature=youtube_gdata

and I need them to be rewritten as

http://www.youtube.com/v/xxxxxxxxx?fs=1&autoplay=1

I've seen a couple of similar topics here on SO, but given my limited jQuery and regex talents I wasn't able to get anything to work for my purposes.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about youtube