Viewing 30 posts - 1 through 30 (of 37 total)
  • Author
    Posts
  • #931214

    Hello there
    Is there a tutorial or some thread clear to solve this problem ?
    There are 10 threads who recall this matter but no one is clear.

    Can you help ?
    BR
    Stefano

    #931583
    #931863

    Hi,

    Thank you for using Enfold.

    Please insert a color section and use an mp4 video as the section background. After that, just add this script in the functions.php file.

    add_action('wp_footer', 'ava_custom_script');
    function ava_custom_script(){
    	?>
    		<script type="text/javascript">
    	(function($) {	
    		$('.avia_video').on('av-mediajs-loaded', function() {
    			$('.av-section-color-overlay-wrap').prepend('<div class="custom-mute"></div>');
    			var video = $(this).mediaelementplayer();
    			video[0].setMuted(true);
    			$('.av-section-color-overlay-wrap').on('click', '.custom-mute', function() {
    				if(video[0].muted === true) {
    					video[0].setMuted(false);
    					video[0].setVolume(0.8);
    				} else {
    					video[0].setMuted(true);
    				}		
    			});
    		});
    		
    		$('.av-section-color-overlay-wrap').on('click', '.custom-mute', function() {
    			$(this).toggleClass("icon-sound-on");
    		});
    	})(jQuery);
    	</script>
    	<?php
    }

    And the following css codes in the Quick CSS field.

    .custom-mute {
    	display: block;
    	background-image: url('my site/unmute.png');
    	background-size: 40px;
    	width: 40px;
    	height: 40px;
    	position: absolute;
    	bottom: 40px;
    	right: 40px;
    	z-index: 1000;
    }
    .custom-mute:hover {
    	opacity: 0.5;
    }
    .icon-sound-on {
    	background-image: url('my site/mute.png');
    }
    @media only screen and (max-width: 1290px) {
    .custom-mute {
    	right: 190px;
    }
    }

    Adjust the background image url with your own mute and unmute images.

    Best regards,
    Ismael

    #1004448

    Hi,

    That’s perfect for me, but I want my video to be unmute when loading the page, and the button to mute it if the visitor doesn’t want the sound (it’s a video for a music group, so the sound is important !). I tried to invert with video[0].setMuted(false); video[0].setVolume(0.8); under the var declaration, but it doesn’t work… Can you tell me how I can do that please ?

    Thank you !

    #1004798

    Hi,

    Where are you testing this? The video is muted by default. You need to edit the color section file.

    // https://kriesi.at/support/topic/color-section-background-video-un-mute-activate-sound/

    Best regards,
    Ismael

    #1005215

    Hi,

    I test it on a private page. I want the video to be unmute by default, and the button to mute / unmute. The link you gave me, I already saw it but the file to implement is not downoadable anymore … Can you help ?

    Thanks ;)

    #1005428

    Hi,

    What do you mean it’s not downloadable? The section.php file should be located in the theme’s config-templatebuilder > avia-shortcode folder.

    Best regards,
    Ismael

    #1005484

    Hi,
    I did change on my section.php file to have : ‘video_mute’ => false.
    Then I added that in my functions.php: to be able to change betwwen mute / unmute.
    add_action(‘wp_footer’, ‘ava_custom_script’);
    function ava_custom_script(){
    ?>
    <script type=”text/javascript”>
    (function($) {
    $(‘.avia_video’).on(‘av-mediajs-loaded’, function() {
    $(‘.av-section-color-overlay-wrap’).prepend(‘<div class=”custom-mute”></div>’);
    var video = $(this).mediaelementplayer();
    video[0].setMuted(true);
    $(‘.av-section-color-overlay-wrap’).on(‘click’, ‘.custom-mute’, function() {
    if(video[0].muted === true) {
    video[0].setMuted(false);
    video[0].setVolume(0.8);
    } else {
    video[0].setMuted(true);
    }
    });
    });

    $(‘.av-section-color-overlay-wrap’).on(‘click’, ‘.custom-mute’, function() {
    $(this).toggleClass(“icon-sound-on”);
    });
    })(jQuery);
    </script>

    I would like the video to be Muted = false at the beginning, but if I change to video[0].setMuted(flase); , I have an error occuring…

    #1005714

    Hi,

    What happens when you remove that particular line?

    video[0].setMuted(true);
    

    Please create another thread and then post the login details in the private field. We would like to test it.

    Best regards,
    Ismael

    #1006189

    Oh yes, it works… So simple ;)

    Thanks a lot !

    #1006301

    Hi mcourbot,

    Glad you got it working for you! :)

    If you need further assistance please let us know.

    Best regards,
    Victoria

    #1268098

    Hi perfect !

    It work perfectly with a self hosted video, but it seems it’s not working with a viemo or youtube video ?
    Is ther a way to do that ?

    Thanks

    #1268108

    Hello,

    Thanks for this amazing theme!

    I have some troubles to make this solution work.
    I followed all the beginning of this forum but the sound mute/unmute button is not working under safari on Mac or iPad.

    Second question, (sorry for my English but I wanted to be sure…
    It’s not possible to make a video background autoplay direct with sound (the user can mute with the button.)

    Here is the code added in function.php:

    add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
    function avia_include_shortcode_template($paths){
      $template_url = get_stylesheet_directory();
          array_unshift($paths, $template_url.'/shortcodes/');
      return $paths;
    }
    add_action('wp_footer', 'ava_custom_script');
    function ava_custom_script(){
    	?>
    		<script type="text/javascript">
    	(function($) {	
    		$('.avia_video').on('av-mediajs-loaded', function() {
    			$('.av-section-color-overlay-wrap').prepend('<div class="custom-mute"></div>');
    			var video = $(this).mediaelementplayer();
    			video[0].setMuted(true);
    			$('.av-section-color-overlay-wrap').on('click', '.custom-mute', function() {
    				if(video[0].muted === true) {
    					video[0].setMuted(false);
    					video[0].setVolume(0.8);
    				} else {
    					video[0].setMuted(true);
    				}		
    			});
    		});
    		
    		$('.av-section-color-overlay-wrap').on('click', '.custom-mute', function() {
    			$(this).toggleClass("icon-sound-on");
    		});
    	})(jQuery);
    	</script>
    	<?php
    }

    Here is my CSS:

    .custom-mute {
    	display: block;
    	background-image: url('/wp-content/uploads/mute.png');
    	background-size: 40px;
    	width: 40px;
    	height: 40px;
    	position: absolute;
    	bottom: 20px;
    	right: 20px;
    	z-index: 1000;
    }
    .custom-mute:hover {
    	opacity: 0.5;
    }
    .icon-sound-on {
    	background-image: url('/wp-content/uploads/unmute.png');
    }
    @media only screen and (max-width: 1290px) {
    .custom-mute {
    	right: 1%;
            bottom: 1%;
    }
    }
    @media only screen and (max-width: 767px) {
    .custom-mute {
    	display: none;
    }
    }

    Thanks a lot!
    Aryan

    #1268435

    Hi,


    @necessary66
    : The audio toggle or button works fine on Firefox Dev Windows 10. Do you see any error in the browser console when you check or test the audio button on Safari?

    Best regards,
    Ismael

    #1268456
    #1268468
    #1268472

    these are my two sites ( backgroud-video on slider and on color-section) :
    https://webers-testseite.de/mute-unmute-video-slide/
    https://webers-testseite.de/mute-unmute/

    And you are right – that on safari this did not work – with exactly your error log. i tested this on former times on safari too and it worked. So something must have changed in the source code either Enfolds, WordPress or Safari. These Sites above are from 2019-02-13 and color-section site from : 2018-05-01.
    By the way: the domain above is still on WP 5.5.3

    #1268474

    The error doesn’t come up when I remove this part :

    add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
    function avia_include_shortcode_template($paths){
      $template_url = get_stylesheet_directory();
          array_unshift($paths, $template_url.'/shortcodes/');
      return $paths;
    }
    add_action('wp_footer', 'ava_custom_script');
    function ava_custom_script(){
    	?>
    		<script type="text/javascript">
    	(function($) {	
    		$('.avia_video').on('av-mediajs-loaded', function() {
    			$('.av-section-color-overlay-wrap').prepend('<div class="custom-mute"></div>');
    			var video = $(this).mediaelementplayer();
    			video[0].setMuted(true);
    			$('.av-section-color-overlay-wrap').on('click', '.custom-mute', function() {
    				if(video[0].muted === true) {
    					video[0].setMuted(false);
    					video[0].setVolume(0.8);
    				} else {
    					video[0].setMuted(true);
    				}		
    			});
    		});
    		
    		$('.av-section-color-overlay-wrap').on('click', '.custom-mute', function() {
    			$(this).toggleClass("icon-sound-on");
    		});
    	})(jQuery);
    	</script>
    	<?php
    }
    #1268476

    Yes i know – but exactly this code does work on Safari too on former installations.

    btw. : this part is only for child-theme shortcodes replacement and should stay in your child-theme functions.php

    add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
    function avia_include_shortcode_template($paths){
      $template_url = get_stylesheet_directory();
          array_unshift($paths, $template_url.'/shortcodes/');
      return $paths;
    }
    #1268479

    Very strange!!!

    #1268480

    mediaelement-and-player.min.js is part of WordPress – so i guess on one of the last updates ( and as i said i did not update to WP5.6) there must be a sourcecode difference to older WP Versions.

    #1268484

    I have a problem with safari,
    I have also a problem with the audio of my video: sometime (I don’t know exactly when, often on my iPad, sometime on firefox the sound is like it was 2 différent soundtracks with few milliseconds of difference… I don’t know if I’m clear…

    I tried to encode the video different ways, but still strange…

    Thanks

    #1268978

    Any leads about this problem in safari? I’m still stuck on this problem…
    Thanks a lot!
    Aryan

    #1269001

    Mh – that class isn’t added to mediaelementwrapper video : av-mediajs-loaded in Safari!
    so the trigger for that function does not exist on safari.
    On Firefox and Chrome this class is added when the video has fully loaded.

    #1271383

    Hello and happy new year everybody.

    Any leads on this problem on safari?

    Thanks again!

    #1271384

    Hello and happy new year everybody.

    Any leads on this problem on safari?

    Thanks again!

    #1271792

    Hi,

    We are still trying to figure out why this is not working on Safari browsers. You can check the discussion in the following thread.

    // https://kriesi.at/support/topic/mediaelementplayer-and-safari/

    Best regards,
    Ismael

    #1275111

    Hello guy’s,

    I moved the website to the final destination, I did the last update of wordpress and something seems to be différent on safari: at the load of the page, the autoplay doesn’t work and the video don’t start, keeping a black screen. Il I click on the red volum button, the video starts and the sound is there!!!

    Now, I just have to found out how to autostart the video on safari (autoplay works on chrome and firefox).

    Thanks a lot!

    #1276209

    Hi,

    Thank you for that info.

    Do you see any errors in the browser console when you check the site on Safari? I asked the rest of the team to inspect the issue on Safari and hopefully they will find the problem and provide a working solution.

    Best regards,
    Ismael

    #1276275

    Now I have this message in the console:

    https://handiamo.com/wp-content/uploads/2021/01/Capture-decran-2021-01-29-a-10.23.25.png

    Thanks again for your help!

    Best regards

Viewing 30 posts - 1 through 30 (of 37 total)
  • You must be logged in to reply to this topic.