Hello! I’m having problems changing how videos are played in the theme I’m using (toha Toha | Hugo Themes). It has a shortcode for video, but not much I can really do to change how the video is played. My main issue is trying to make it autoplay, loop, and not have controls. A gif, effectively.
Digging around in the files, I can see it uses plyr, which I believe to be this (GitHub - sampotts/plyr: A simple HTML5, YouTube and Vimeo player), but I’m not having any luck changing it in the theme. I am a programmer, but not a web developer. I’m not really sure what I’m dealing with here, to be honest. The most I’ve done before was some basic HTML/CSS some 5 years ago. How could I make the mentioned changes? I don’t mind if it replaces things in the theme, I just really need this site up and running.
I did also enable unsafe code to the HTML video tag in myself in the markup, but I didn’t get far with that since it isn’t playing nice with things like window resizing, and trying to add some CSS just wouldn’t work.
Any help is appricated, thank you!
Override the theme’s video shortcode.
mkdir -p layouts/shortcodes
cp themes/toha/layouts/shortcodes/video.html layouts/shortcodes/
Then change the
video element attributes as needed, adding or removing options as needed.
Or modify the code to accept player options as shortcode parameters.
- I think most people find
autoplay to be intrusive and annoying, and simply adding the
autoplay attribute is not enough for some browsers. Chrome, for example, will not autoplay unless the
muted attribute is also present.
- The player already hides the controls “automatically after 2s of no mouse or focus movement, on control element blur (tab out), on playback start or entering fullscreen.”
This was one of the things I tried before, unfortunately. It does make it autoplay and loop and so on, but the controls insist on being there, and I think that’s a part of plyr.
Also don’t worry, these are muted. I know just how anoying autoplay can be, but I figured it’d be good for a project page on a portfolio
Actually, jmooring is right. I misunderstood something about the options so it wasn’t doing anything for me. All works now, thanks.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.