Features

Allow product video looping/disable controls for a cleaner look

7mo agoIn Review

Allow product video looping/disable controls for a cleaner look.

3 comments

  1. Anonymous7mo ago

    Hello @martincarpenter

    Thank you for idea but we already have next filter 'single_product_main_gallery_video_attributes' in our theme files that allows you to modify the html video tag attributes of product gallery.
    Here you can find few examples:
    1/ https://www.8theme.com/topic/help-resolve-these-3-issues-in-single-product-pages/#post-359362
    2/ https://www.8theme.com/topic/help-resolve-these-3-issues-in-single-product-pages/#post-359175
    3/ https://www.8theme.com/topic/featured-product-video-breaks-singe-product-gallery/#post-358598
    Hope you will find those answers good for your request and solve your request by adding one of those or create new one filtered video attributes.

    Kind regards, Jack Richardson

    1. Hi Jack,

      Thanks for the reply I have got the videos looping with the filter you linked.

      The same filter for controls="false" does not seem to work however and inspecting the element still shows controls="controls".

      add_filter('single_product_main_gallery_video_attributes', function($atts = array()) {
      $atts[] = 'controls="false"';
      return $atts;
      });

      Kind regards

    2. Anonymous7mo ago

      Hello @martincarpenter,

      In case you want to hide controls then you should. make it in another way:
      Instead of making it with this code:
      add_filter('single_product_main_gallery_video_attributes', function($atts = array()) {
      $atts[] = 'controls="false"';
      return $atts;
      });

      Try to use next one:
      add_filter('single_product_main_gallery_video_attributes', function($atts = array()) { unset($atts[array_search('controls="controls"', $atts)]);
      return $atts;
      });

      Because most browsers need to know if there is "controls" key with any value and then they will add controls for video. Otherwise if such attribute does not exist then there will be no controls.

      Kind regards, Jack Richardson