Support » Plugin: Complianz - GDPR/CCPA Cookie Consent » Youtube player changes in size

  • Hi guys,

    In Complianz, I finally found a cookie plugin that works! You guys are the best.
    the Wizard/turtorial was very helpful as well.

    There is one thing that confuses me, on activating the plugin it changes the size of my embedded youtube players. Is there any way to fix this? Because while it funtions correctly (blocking the video until consent is given) it doesn’t look as pretty.

    Thanks in advance for your reply.

Viewing 15 replies - 31 through 45 (of 84 total)
  • Plugin Author RogierLankhorst


    @bonaldi good point! 🙂

    fixed, will push soon.

    This should be cmplz_dailymotion_image_

    I also noticed the use of thumbnail_large_url which is deprecated, it should be replaced by thumbnail_1080_url or at least thumbnail_720_url

                case 'dailymotion':
                    if (preg_match('/dailymotion\.com\/(embed\/video)\/([^_]+)[^#]*\?|dailymotion\.com\/(embed\/video|video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?|(dai\.ly\/([^_]+))!/i', $src, $matches)) {
                        if (isset($matches[6])) {
                            $daily_motion_id = $matches[6];
                        }elseif (isset($matches[4])) {
                            $daily_motion_id = $matches[4];
                            $daily_motion_id = $matches[2];
                        $new_src = get_transient("cmplz_dailymotion_image_$daily_motion_id");
                        if (!$new_src) {
                            $thumbnail_1080_url=''.$daily_motion_id.'?fields=thumbnail_1080_url'; //pass thumbnail_60_url (60px height), thumbnail_120_url (120px height), thumbnail_180_url (180px height), thumbnail_240_url (240px height), thumbnail_360_url (360px height), thumbnail_480_url (480px height), thumbnail_720_url (720px height), thumbnail_1080_url (1080px height), for different sizes
                            $json_thumbnail = file_get_contents($thumbnail_1080_url);
                            $arr_dailymotion = json_decode($json_thumbnail, TRUE);
                            $new_src = $arr_dailymotion['thumbnail_1080_url'];
                            $new_src = cmplz_download_to_site($new_src, $type.$daily_motion_id);
                            set_transient("cmplz_dailymotion_image_$daily_motion_id", $new_src, WEEK_IN_SECONDS);

    For DailyMotion height problem : in class-cookie-blocker.php line 162,

    replace :

    $video_class = (strpos($iframe_src, 'youtube')!==false || strpos($iframe_src, 'vimeo')!==false) ? 'cmplz-video' : '';

    with :

    $video_class = (strpos($iframe_src, 'youtube')!==false || strpos($iframe_src, 'vimeo')!==false || strpos($iframe_src, 'dailymotion')!==false) ? 'cmplz-video' : '';

    Plugin Author RogierLankhorst


    That was already done, I removed it earlier on purpose because the aspect ratio of the placeholder didn’t match the video. But it’s on git already together with the other edits.

    Hi Rogier,

    In function.php, this comment could be updated because its terms are deprecated: //pass thumbnail_large_url, thumbnail_medium_url, thumbnail_small_url for different sizes

    Similarly, the name of the variable $thumbnail_large_url could be replaced to avoid confusion.

    These are just a few suggestions to help, but of course, I would not want you to feel challenged in your choices.


    Hi Rogier,

    I have identified a new problem: when cookies are accepted, the height value of the div is not correct.
    It should no longer be calculated based on the thumbnail, since it is no longer in src.
    The height should be inherited in css.


    Plugin Author RogierLankhorst


    There is a risk in this kind of adjustments. If the placeholder has a very different size, the div will get a completely different aspect ratio than the movie, which seems to happen with the dailymotion placeholder. I’m not sure this is the best way to solve this yet, but I’ll leave it in if there are no obvious issues on our testing environments.

    I have adjusted the script to set the container div to ‘inherit’ after enabling cookies.

    Let me know if this works for you.

    Hi Rogier,

    It doesn’t work.

    After enabling cookies, cmplz-blocked-content-container cmplz-video still has the height injected by the setBlockedContentContainerAspectRatio function.

    This injected height should be removed if cookies are accepted, and the standard .cmplz-blocked-content-container css (inherit) height should be used.

    You can test it in my home page video header.
    Maybe a problem targeting the right parent folder?


    Plugin Author RogierLankhorst


    When I check your site, and accept cookies, I see the following in the source:
    <div class="cmplz-blocked-content-container cmplz-video" style="height: inherit;">

    And the container has taken the height of the video. Possibly the file is still cached in your browser.


    Of course, I emptied my cache and I have this:
    <div class="cmplz-blocked-content-container cmplz-video" style="height: 713.25px;">

    I will investigate more.
    I’m coming back towards you.

    So when we click to accept cookies, we have:

    <div class="cmplz-blocked-content-container cmplz-video" style="height: inherit;">.

    If we reload the page, we come back to:

    <div class="cmplz-blocked-content-container cmplz-video" style="height: 713.25px;">

    Plugin Author RogierLankhorst


    Ah, I now see the problem. Because of your FitVid implementation, an extra div is inserted. The height is reset on the parent of the video. I have now changed this to be adjusted directly on the cmplz-video class.

    Yes, Fitvids always inserts an extra div.
    I tried with the latest version of Github, but nothing seems to change.
    Is it up to date?

    Plugin Author RogierLankhorst


    I think I didn’t merge it yet, it was still in the pull request.

    The new source should contain these lines:

Viewing 15 replies - 31 through 45 (of 84 total)
  • The topic ‘Youtube player changes in size’ is closed to new replies.