Kentico 7 and Responsive YouTube

Dan Gowans asked on June 26, 2014 10:02

I am working on a responsive website design, and would like to incorporate in YouTube videos. The WYSIWYG toolbar has the ability to insert YouTube videos. The generated code is a simple iframe.

<iframe width="560" height="340" frameborder="0" allowfullscreen="" src="http://www.youtube.com/embed/99qm_9aJcLQ?fs=1&amp;rel=0&amp;enablejsapi=1&amp;version=3" type="text/html"></iframe>

I found a website that describes a technique to make YouTube videos responsive. Is it possible to change to generated code to be wrapped inside a div, like this?

<div class="videoContainer">
    <iframe width="560" height="340" frameborder="0" allowfullscreen="" src="http://www.youtube.com/embed/99qm_9aJcLQ?fs=1&amp;rel=0&amp;enablejsapi=1&amp;version=3" type="text/html"></iframe>
</div>

I made changes to the YouTube widget and the YouTube web part, and neither seem to affect this code.

Correct Answer

Brenden Kehren answered on June 26, 2014 13:01

I believe in the YouTubeVideo.ascx.cs line 171 (version 8) the last line where the MediaHelper.GetYouTubeVideo(ytParams) is retrieved, actually is what is generating that iframe tag. Should be able to wrap that literal control in the div.

2 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on June 26, 2014 20:51

Keep in mind when you do an upgrade this file will fail the upgrade because it is different that the original. So note you will have to merge any changes that might be sent over from Kentico. A better solution I failed to mention was to clone this webpart and make it "your own" THEN make the change to the HTML.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.