Notifications
Clear all

[Solved] Video preload

21 Posts
3 Users
2 Reactions
4,098 Views
Posts: 26
Customer
Topic starter
(@gary-yates)
Member
Joined: 5 years ago

@kylew,

 

I've tried this and it's not working. I've cleared all cookies and cache. Is there a different way to accomplish this?

20 Replies
Posts: 26
Customer
Topic starter
(@gary-yates)
Member
Joined: 5 years ago

I noticed too late to delete my comment that this solution is for wpDiscuz. I found this answer by searching the forum for preload but I haven't been able to find a similar solution for wpForo. Is there a way to set all the videos in wpForo to preload=none?

 

P.S. I have Advanced Attachments

1 Reply
Kyle
 Kyle
(@kylew)
Joined: 3 years ago

Prominent Member
Posts: 728

@gary-yates,

Please put the following code in the current active theme functions.php file:

add_filter('wpforo_content_filter', function($content){
    return preg_replace('#(<video)(\s?[^<>]*?>)#iu', '$1 preload="none"$2', $content);
}, 99);

Don't forget to delete all caches and press CTRL+F5(twice) on the frontend before checking.

Also please note the code works only for the front-end

Posts: 26
Customer
Topic starter
(@gary-yates)
Member
Joined: 5 years ago

@kylew

 

The preload attribute does not stay equal to none. Eventually, it always reverts back to metadata.

 

Thanks

1 Reply
Kyle
 Kyle
(@kylew)
Joined: 3 years ago

Prominent Member
Posts: 728

@gary-yates,

Can you provide an example with screenshots and links?

Posts: 26
Customer
Topic starter
(@gary-yates)
Member
Joined: 5 years ago

@kylew,

 

What are you looking for screenshots and links of? The site is stbfitnesscenter.com if that helps. The code is in my active theme's functions.php file.

I posted the coding above:

add_filter('wpforo_content_filter', function($content){
return preg_replace('#(<video)(\s?[^<>]*?>)#iu', '$1 preload="none"$2', $content);
}, 99);

And after a while, I'm not sure exactly how long, the coding reverted back to what I believe is its default setting:

add_filter('wpforo_content_filter', function($content){
return preg_replace('#(<video)(\s?[^<>]*?>)#iu', '$1 preload="metadata"$2', $content);
}, 99);

Since I just changed the coding back to preload=none this morning, this is not an issue right now but it happened twice already and I believe it will happen again.

Posts: 26
Customer
Topic starter
(@gary-yates)
Member
Joined: 5 years ago

I also just noticed another issue while checking the preload attribute. If you want me to post it as another topic just let me know. 

 

Once I fullscreen a video, then return the video to its normal size, the video is no longer visible. You can still hear the video playing in the background tho. You can use any of the videos here as an example... https://stbfitnesscenter.com/community/she-shed/test-jackie/

1 Reply
 Tom
Admin
(@tomson)
Joined: 10 years ago

Famed Member
Posts: 4214

@gary-yates,

I see the problem comes from FitVids plugin, this plugin adds some wrapper div around wpForo videos, and it controls wpForo videos. All problems of wpForo videos come from this plugin. You should find a way to disable this plugin on forum pages or remove it totally. We don't support such conflicts, you should contact FitVids plugin developers and ask them an option to totally disable their plugin on certain pages.

2021 09 23 16 29 34
Page 1 / 3
Share:
Scroll to top