Why Not Responsive YouTube Videos into Sitecore
Why Not Responsive YouTube Videos into Sitecore
That’s it! Quicker and easier than writing this blog post 😊
If you would like the ultimate control over the video so that it is a specific width and height on the desktop, and is still responsive on the mobile, here is how:
The mobile version will remain responsive, but the size of the desktop video changes. https://xchangesitecore.com/why-not-responsive-youtube-videos-into-sitecore/ Vikash Raaj
Lets learn how to embed a you-tube video into the Sitecore page which should work in responsive way.
All-in-one Responsive Embed Option
- From YouTube, copy the Video URL you want to embed on your page. (Don’t use share; it’s not required for this)
- Visit www.EmbedResponsively.com and paste the URL into the input box and click the Embed button.
- At the bottom of the displayed video, copy the style-based embed code.
- Log into the Sitecore Content Editor and select the page on which you want the video embedded.
- Open the Rich Text field in HTML mode by clicking the Edit HTML option.
- Position the cursor where you want the video to appear on the page and paste in the embed code.
- Accept, Save and Publish your page and test on your mobile or emulator within your browser.
That’s it! Quicker and easier than writing this blog post 😊
Advanced Option
If you would like the ultimate control over the video so that it is a specific width and height on the desktop, and is still responsive on the mobile, here is how:
- Follow Steps 1 to 6 above.
- Copy the following code “@media only screen and (max-width: 768px) {“, without the quotes
- Place it after “<style>” and before “.embed-container” of the responsive code.
- Add a closing curly brace “}” after “height: 100%; }” and before “</style>”.
It should look like this “height: 100%; }}</style>” with two curly braces before the closing “</style>” tag.
- Add your width and height after "<iframe " – in our example, it looks like “<iframe width="400" height="225"…”
- Accept, Save and Publish your page and test on both your mobile and desktop.
The mobile version will remain responsive, but the size of the desktop video changes. https://xchangesitecore.com/why-not-responsive-youtube-videos-into-sitecore/ Vikash Raaj
Comments
Post a Comment