cancel
Showing results for 
Search instead for 
Did you mean: 

How to embed responsive youtube videos using just the url? Javascript or PHP

How to embed responsive youtube videos using just the url? Javascript or PHP

I am trying to find a javascript code to place in Design/Misc Scripts section in magento or something similar to auto detect URLs and Youtube URLs to properly embed links and parse videos using only the link from youtube like https://www.youtube.com/watch?v=mYyoutubeVideoNumber.  I'm currently using a div class and a styles.css edit to properly embed responsive videos and wonder if an integration could be achieved where magento detects a URL and creates a link and also can detect a youtube url and display a responsive video.  I have found a thread about a process to replace urls with links that is interesting and probably the way to go, just not sure exacly how to implement it.  --->

 

http://stackoverflow.com/questions/37684/how-to-replace-plain-urls-with-links

 

Also, here is the videoWrapper div class code that I found online to embed responsive videos on magento pages and static blocks. 

--->

 

<div class="videoWrapper">
<iframe width="100%" src="http://www.youtube.com/embed/videoseries?list=mYplayListNumber.&amp;hl=en_US" frameborder="0" allowfullscreen></iframe>
</div>

 

with the following code in styles.css

 

/* Video Wrapper */

.videoWrapper {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
}
.videoWrapper iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

 

Any help or enlightment would be appreciated.

1 REPLY 1

Re: How to embed responsive youtube videos using just the url? Javascript or PHP

Does anyone know of an extension that will automatically show a URL with a http link?  I looked on magento commerce and couldn't find anything even for a simle auto url link. Maybe the youtube auto URL link is too complicated.