-
AuthorPosts
-
November 26, 2018 at 11:07 pm #1037834
Hi there,
I have added a video to my homepage and it looks great. However, I want it to autoplay upon page load and I don’t see any controls for this. I tried a code block with embed code from Vimeo and it looked horrible and still didn’t auto play! Can you help? I want it to look exactly as it does now, but with autoplay.
November 28, 2018 at 4:42 pm #1038583Hey 1lizcollins,
Please post us your login credentials (in the “private data” field), so we can take a look at your backend.
- Install and activate ” Temporary Login Without Password “.
- Go to ” Users > Temporary Logins ” on the left-side menu.
- Click ” Create New “.
- Add the email address for the account ( you can use (Email address hidden if logged out) ), as well as the ” Role ” making that the highest possible and the expiry about four days
( do be sure that we have enough time to debug ). - Click ” Submit “.
- You’ll now have a temporary account. Please provide us here in the private section the URL, so we can login and help you out.
When your issue is fixed, you can always remove the plugin!
If you prefer to not use the plugin, you can manually create a admin user and post the login credentials in the “private data” field.Best regards,
NikkoNovember 28, 2018 at 5:05 pm #1038599Thanks for your help! I prefer not to use this plugin – credentials below.
December 3, 2018 at 6:49 am #1040143Hi,
It’s possible to enable autoplay but you have to mute the video. This is in accordance with the browsers’ autoplay policy.
// https://developers.google.com/web/updates/2017/09/autoplay-policy-changes
Chrome’s autoplay policies are simple:
Muted autoplay is always allowed.
Autoplay with sound is allowed if:
User has interacted with the domain (click, tap, etc.).
On desktop, the user’s Media Engagement Index threshold has been crossed, meaning the user has previously play video with sound.
On mobile, the user has [added the site to their home screen].
Top frames can delegate autoplay permission to their iframes to allow autoplay with sound.Best regards,
IsmaelDecember 3, 2018 at 5:22 pm #1040401Thanks for the response. Unfortunately I’m still stuck here. I added a string to the URL of the video which mutes it, and the Enfold video player still isn’t working. Your response did outline Chrome’s rule, which I appreciate, but you’ve left out how to make your video element function as it should. I’ve tried adding the embed code from Vimeo and it autoplays but none of the code that is supposed to control it’s size seems to be working.
I either need the Enfold video player to autoplay or help getting the embed code to fit the full width of the content area. Can you please help? You’ll see the video player first, with the embed code underneath on the link below. Thanks in advance.
December 3, 2018 at 9:08 pm #1040470I’ve just tested the embedded video on another staging site that is running PHP7.2 (the current install is running PHP5.6), but it still won’t auto-play. Link below.
December 3, 2018 at 10:16 pm #1040484I’ve decided to use full-width easy slider as I really need a solution asap, and I’m testing on a new page (link below, credentials are the same). It autoplays if muted but there are no visible controls so the user cannot hear the script for the video which is essential. I’ve selected various controls for the slider in the settings panel but none are visible to a site visitor. Please help! I’m open to using any of the options available with the theme, but none are working as expected. I just need full-width, autoplay, and the ability to adjust volume, etc. Thanks in advance.
- This reply was modified 6 years ago by 1lizcollins.
December 5, 2018 at 4:55 am #1041065Hi,
Thanks for the update. Add the following script in the functions.php file to set the volume to 100 when the video starts to play.
add_action('wp_footer', 'ava_custom_vimeo_api'); function ava_custom_vimeo_api(){ ?> <script type="text/javascript"> var iframe = document.querySelector('.av-video-slide .mejs-mediaelement iframe'); var player = new Vimeo.Player(iframe); player.on('play', function() { console.log('playing'); player.setVolume(100); }); </script> <?php }
Best regards,
IsmaelDecember 5, 2018 at 5:45 am #1041072Thanks Ismael. I added the code, cleared my cache several times and reloaded, and the video still autoplays silently. What else can we try?
December 6, 2018 at 11:40 am #1041568Hi,
Add this code above the previous script tag.
<script src="https://player.vimeo.com/api/player.js"></script>
That should fix the error in the console:
ReferenceError: Vimeo is not defined
Best regards,
IsmaelDecember 6, 2018 at 2:36 pm #1041667Hi Ismael,
Thanks again for your reply. I’ve added that script but there is still no sound on autoplay. Is this order correct?
add_action(‘wp_footer’, ‘ava_custom_vimeo_api’);
function ava_custom_vimeo_api(){
?>
<script src=”https://player.vimeo.com/api/player.js”></script>
<script type=”text/javascript”>
var iframe = document.querySelector(‘.av-video-slide .mejs-mediaelement iframe’);
var player = new Vimeo.Player(iframe);player.on(‘play’, function() {
console.log(‘playing’);
player.setVolume(100);
});
</script>
<?php
}Thanks in advance for your help here. My client is getting quite antsy to get their video up on the homepage – what else can we try?
December 7, 2018 at 11:37 am #1041988Hi,
Looks like you can’t play the video with sounds unless the user interact with the video first. This script sets the volume to 100% but then the browser automatically pause the video because there’s no interaction.
add_action('wp_footer', 'ava_custom_vimeo_api'); function ava_custom_vimeo_api(){ ?> <script src="https://player.vimeo.com/api/player.js"></script> <script type="text/javascript"> document.addEventListener( "DOMContentLoaded", () => { var player = null; let slide = document.querySelector('.av-video-slide'); let iframes = slide.getElementsByTagName('iframe'); for (var i = 0; i < 1; i++) { player = new Vimeo.Player(iframes[i]); } player.on('play', function() { console.log('playing'); player.setVolume(1); }); // player.on('pause', function() { // console.log('paused'); // player.play(); // }); }); </script> <?php }
This is what you’ll get after setting the volume:
player.js:2 Unmuting failed and the element was paused instead because the user didn't interact with the document before. https://goo.gl/xX8pDD
If you listen for the “pause” event and call the play method there, the browser will pause the video infinitely.
One workaround is to disable the autoplay and then add a caption > button to the slider. Users will then be able to play the video manually. Use this code to trigger the play method when the user click on the slider button.
add_action('wp_footer', 'ava_custom_vimeo_api'); function ava_custom_vimeo_api(){ ?> <script src="https://player.vimeo.com/api/player.js"></script> <script type="text/javascript"> document.addEventListener( "DOMContentLoaded", () => { var player = null; let slide = document.querySelector('.av-video-slide'); let iframes = slide.getElementsByTagName('iframe'); for (var i = 0; i < 1; i++) { player = new Vimeo.Player(iframes[i]); } player.on('play', function() { console.log('playing'); player.setVolume(1); }); slide.querySelector('.avia-slideshow-button').addEventListener( 'click', () => { player.play(); }); }); </script> <?php }
Best regards,
IsmaelDecember 10, 2018 at 2:22 am #1042864Hi Ismael,
Thanks again for bearing with me. I replaced the old code with the last bit you sent, but there is no button. There is sound when i click the image, thankfully, but without a button users will have no idea it’s a video. What else can we try to get a play button?
December 10, 2018 at 5:51 am #1042909Hi,
but there is no button.
You have to add the button manually. Edit the slide and then go to the Captions panel. You’ll be able to add a button there.
Best regards,
IsmaelDecember 11, 2018 at 2:13 am #1043494Thanks Ismael – I missed this in your previous post. I’ve taken a look a the options on the caption tab, and I see the ability to add a button. I did so, with no link and I get a blank page, and I can’t figure out what url would be appropriate. Can you please spell this out for me? What exactly do I need to do to get a play button that works?
December 12, 2018 at 8:40 pm #1044477Hi again – any update on this? My client cannot understand why I can’t get a simple video in place with a play button, and honestly, neither can I. I need this video in place by tomorrow – can someone please help me get this sorted out?
December 13, 2018 at 6:18 am #1044711Hi,
Sorry for the late response. Just add a hashtag symbol in the url field, so the button doesn’t link anywhere. I’ve already edited the button url, so you can test the play button now. It’s working properly on my end.
Best regards,
IsmaelDecember 13, 2018 at 8:56 pm #1045026Thanks, Ismael. We still have a problem – that button does not disappear when the video plays, so it’s obscuring the center of the video the whole time. What can we do about this?
December 17, 2018 at 6:16 am #1046170Hi,
Replace the script with this, so it hides the button on play and render it back on pause.
add_action('wp_footer', 'ava_custom_vimeo_api'); function ava_custom_vimeo_api(){ ?> <script src="https://player.vimeo.com/api/player.js"></script> <script type="text/javascript"> document.addEventListener( "DOMContentLoaded", () => { const player = null; let slide = document.querySelector('.av-video-slide'); let iframes = slide.getElementsByTagName('iframe'); const button = slide.querySelector('.avia-slideshow-button'); for (var i = 0; i < 1; i++) { player = new Vimeo.Player(iframes[i]); } player.on('play', function() { button.style.display = 'none'; player.setVolume(1); }); player.on('pause', function() { button.style.display = 'block'; }); button.addEventListener( 'click', () => { player.play(); }); }); </script> <?php }
Best regards,
IsmaelJanuary 4, 2019 at 11:55 pm #1050127Thanks Ismael. Unfortunately it looks like we are going backwards here. The button doesn’t work (It actually seems to be obscuring the play button embedded in the video) and when I finally get the video to play once again there is no sound. My client needed this video live weeks ago, and we seem no closer to a fix. I am desperate for a fix here.
On the demo page you will see first the full-width video that is not working, but the smaller video below is actually not bad. Could you please help me get it formatted to span the full-width of the page? Or can we get the full-width video working as expected? I’ve had nothing but positive experiences with you, your team and Enfold until this video issue – please help!
January 7, 2019 at 3:15 pm #1050904Hi,
There’s a minor error in the console. Please look for this line:
const button = slide.querySelector('.avia-slideshow-button');
Replace it with:
let button = slide.querySelector('.avia-slideshow-button');
Best regards,
IsmaelJanuary 7, 2019 at 4:11 pm #1050935Ismael, I made this change but the button does not work; I still cannot play the video. Help!
January 8, 2019 at 3:45 am #1051150Hi,
Odd. Please post the WP and FTP details in the private so that we can modify and test the code.
Best regards,
IsmaelJanuary 8, 2019 at 3:54 am #1051160Thank you! See below.
January 9, 2019 at 12:50 pm #1051801Hi,
Thanks for the info. I adjusted the code a bit. Clicking on the button will play or pause the video and set the volume to 1 or 100%. I also adjusted the button’s position, so it doesn’t cover the video.
add_action('wp_footer', 'ava_custom_vimeo_api'); function ava_custom_vimeo_api(){ ?> <script src="https://player.vimeo.com/api/player.js"></script> <script type="text/javascript"> document.addEventListener( "DOMContentLoaded", () => { let player = null; const slide = document.querySelector('.av-video-slide'); let iframes = slide.getElementsByTagName('iframe'); const button = slide.querySelector('.avia-slideshow-button'); button.classList.add('paused'); for (var i = 0; i < 1; i++) { player = new Vimeo.Player(iframes[i]); } player.on('play', () => { console.log('played'); player.setVolume(1); button.classList.replace('paused', 'playing'); }); player.on('pause', () => { console.log('paused'); button.classList.replace('playing', 'paused'); }); if( slide ) { button.addEventListener( 'click', (e) => { e.preventDefault(); if( button.classList.contains('playing') ) { button.textContent = 'Play Video'; player.pause(); } if( button.classList.contains('paused') ) { button.textContent = 'Pause Video'; player.play(); } }); } }); </script> <?php }
CSS code:
.avia-slideshow-button.paused, .avia-slideshow-button.playing { position: absolute; right: 0; bottom: -50px; }
Best regards,
IsmaelJanuary 18, 2019 at 3:43 am #1055323Hi Ismael,
This looks good and works on desktops, but it doesn’t look right on smaller screens. On the desktop version you see no progress bar, etc, but on smaller screens you can see the progress bar and play button half-way peeking up underneath the play button you have added. Can you remove them, please? I’m fine without them, but having both makes the video player look a bit broken. Thanks.
January 22, 2019 at 4:24 pm #1057285 -
AuthorPosts
- You must be logged in to reply to this topic.