-
AuthorPosts
-
March 22, 2018 at 12:42 pm #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
StefanoMarch 22, 2018 at 7:35 pm #931583I’m referring to this thread https://kriesi.at/support/topic/adding-button-to-mute-unmute-audio-on-fullscreen-background-video/# which is very confused
March 23, 2018 at 10:07 am #931863Hi,
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,
IsmaelSeptember 1, 2018 at 7:00 pm #1004448Hi,
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 !
September 3, 2018 at 7:34 am #1004798Hi,
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,
IsmaelSeptember 3, 2018 at 10:33 pm #1005215Hi,
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 ;)
September 4, 2018 at 11:21 am #1005428Hi,
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,
IsmaelSeptember 4, 2018 at 12:32 pm #1005484Hi,
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…
September 4, 2018 at 5:57 pm #1005714Hi,
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,
IsmaelSeptember 5, 2018 at 3:59 pm #1006189Oh yes, it works… So simple ;)
Thanks a lot !
September 5, 2018 at 8:04 pm #1006301Hi mcourbot,
Glad you got it working for you! :)
If you need further assistance please let us know.
Best regards,
VictoriaDecember 17, 2020 at 12:38 pm #1268098Hi 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
December 17, 2020 at 1:23 pm #1268108Hello,
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!
AryanDecember 18, 2020 at 3:32 pm #1268435Hi,
@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,
IsmaelDecember 18, 2020 at 4:46 pm #1268456Hello,
I don’t know if this is what you. expected:
https://handidev.necessary.fr/wp-content/uploads/2020/12/Capture-decran-2020-12-18-a-15.40.41.png
December 18, 2020 at 6:39 pm #1268468December 18, 2020 at 6:48 pm #1268472these 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.3December 18, 2020 at 6:57 pm #1268474The 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 }
December 18, 2020 at 7:04 pm #1268476Yes 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; }
December 18, 2020 at 7:09 pm #1268479Very strange!!!
December 18, 2020 at 7:19 pm #1268480mediaelement-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.
December 18, 2020 at 8:24 pm #1268484I 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
December 21, 2020 at 11:05 am #1268978Any leads about this problem in safari? I’m still stuck on this problem…
Thanks a lot!
AryanDecember 21, 2020 at 12:33 pm #1269001Mh – 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.January 10, 2021 at 6:09 pm #1271383Hello and happy new year everybody.
Any leads on this problem on safari?
Thanks again!
January 10, 2021 at 6:10 pm #1271384Hello and happy new year everybody.
Any leads on this problem on safari?
Thanks again!
January 12, 2021 at 10:00 am #1271792Hi,
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,
IsmaelJanuary 24, 2021 at 5:52 pm #1275111Hello 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!
January 29, 2021 at 3:46 am #1276209Hi,
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,
IsmaelJanuary 29, 2021 at 11:26 am #1276275Now 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
-
AuthorPosts
- You must be logged in to reply to this topic.