XF 2.1 Is there a way to disable the autoplay of embedded videos from reddit?

If you add this simple script in the post_macros template, you should fix the issue:

Code:
<script>
document.getElementsByTagName('video')[0].removeAttribute('autoplay');
</script>

The problem relies on reddit's iframe which comes with the autoplay option turned on, it's not something which depends on Xenforo I think, and the only way a future version of xenforo would fix such "bugs" would be implementing a solution similar to my one as you have to manipulate an external element (in this example, a reddit video).

Please note my code does remove the autoplay from EVERY video tag, not just Reddit (altough it shouldn't be an issue, that's why I posted it as simple as that).

Hope it helps.
 
Thanks @Sbenny will give that a go for my own site for now.

Would still be good to try and and have something rolled out in the core for all sites if possible, I'm sure most people would agree autoplaying video is a big turn off. Not only annoying when a video at the bottom of the page start playing when you're trying to read from the top, but also potentially a big waste of bandwidth.
 
That's a good idea, I wasn't sure if it was just part of the way XF converted the BB code and could be altered at the point of embed, or if it was an Oembed issue, or purely only an issue controllable by Reddit.
 
I'm not a XF developer so I can't know for sure, but if my supposition is right, it depends exclusively on Reddit, altough Xenforo devs could do something like I did above to fix this issue on Xenforo's side.

The point is, generally speaking, it's always better to solve things at the root of the issue (getting rid of the autoplay feature from Reddit's site) rather than adding unnecessary lines of code which in the long term would result in a pile of superfluous code. If it's just a simple edit like this, it's ok to "hardcode" a fix, but when issues start to pile up, it's a different story :)
 
If you add this simple script in the post_macros template, you should fix the issue:

Code:
<script>
document.getElementsByTagName('video')[0].removeAttribute('autoplay');
</script>

Tried this and it doesn't seem to work unfortuanately.

Tried a few other things couldn't seem to get it to work.

I tried posting on the reddit site for help but no one ever replied to me.


Is there any way we can block these from autoplaying in the core please, or any other suggetions?
 
Top Bottom