Results 1 to 3 of 3

Thread: Responsive video (YouTube element)

  1. #1
    User
    Join Date
    06-19-09.
    Posts
    106

    Default Responsive video (YouTube element)

    Hi, I'm so surprised to find out that the YouTube element isn't responsive – or am I missing something?

    Is there a tested and working solution for using the YouTube element that will so that

    • the specified width and height will be the maximum size the video displays at
    • the video will scale down if the available space is smaller than the specified size

    (I must say that my PHP knowledge is non-existent)

    Thank you for any pointers!

  2. #2
    User Spooky's Avatar
    Join Date
    01-03-13.
    Posts
    339

    Default

    Making it responsive isn't the responsibility of Contao (more or less). Also you do not need any PHP knowledge (well may be some periphery knowledge, since you might need to edit some templates). You need to do it via CSS - whenever possible that is.

    Here is a rundown of handling flexibile media, including videos that are played via MediaElements.js - which is the HTML5 video player that Contao uses.

    However, the proposed changes do not work 100%. Here is a thread on the german forum about this: https://community.contao.org/de/show...ouTube-Element
    Basically the CSS for making it responsive does not really work on Chrome for Android for example, for whatever reason. The official Contao Demo also uses this approach, but it also does not really work on (Android) Smartphones.

    Currently I do not know of any perfect solution. Personally I am more inclined to only use the native HTML5 video player whenever possible, or in case of YouTube just the iframe embedding, since that is far more easy to make responsive.

  3. #3
    User
    Join Date
    06-19-09.
    Posts
    106

    Default

    Thank you for your reply. I accept that customising would be responsibility of the site developer. The issue seems to be that nothing is provided (specifically with the YouTube element) that actually can be properly customised to be responsive. As you say, any solution doesn't seem to work 100%...

    I've implemented something else for the time being, for use with the regular YouTube embed code.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •