• Hi,

    Is there a way to disable/enable more controls on the mediaelement video player? I know there are many more options than the default ones on WordPress, but they don’t seem to work.

    For example, I tried fullscreen=”false”, but nothing happened.

    Any ideas?

Viewing 12 replies - 1 through 12 (of 12 total)
  • If this is a plugin you found in this site you should better try to get help from it’s author.

    Thread Starter Leandro

    (@leandroprz)

    No, this is about the WordPress native media player.

    i see, are you adding an uploaded video or a url link?

    i dont have any experience on the subject but i may find something to help.

    i found this and the option for fullscreen is not supported (by default at least)

    Thread Starter Leandro

    (@leandroprz)

    I saw that, so I made a request for those new features to be added. From what I understand they were introduced in 4.4, but it seems this needs to be done with a filter or something like that, and I don’t really understand how to make it work.

    using the 2016 i tried this and it works

    function add_extra_settings($mejs_settings) {
    
    	$extra_settings = array(
    		'loop' => false,
    		'startVolume' => 0.1,
    		'videoHeight' => -1,
    		'alwaysShowControls' => false,
    		'features' => ['playpause','volume'],
    
    	);
    
    	// combine the two arrays
    	$mejs_settings = array_merge($extra_settings, $mejs_settings);
    
    	return $mejs_settings;
    }
    add_filter('mejs_settings', 'add_extra_settings',9999);

    in your functions.php

    https://pippinsplugins.com/a-quick-introduction-to-using-filters/

    Thread Starter Leandro

    (@leandroprz)

    It’s working perfectly, thanks!

    May I ask, in the last line, what’s the “9999” for?

    it’s a priority number i think you can skip it.

    Thread Starter Leandro

    (@leandroprz)

    Thanks again.

    Is there a way to make the filter work in a custom PHP page where I’m using this?: require('../wp-load.php');

    With that line of code I’m using WordPress native media player outside the WordPress folder, but for some reason it doesn’t load the filter I just added to the functions file.
    I’m not using the theme’s functions.php, but a personal functions file as a plugin where I added all my functions, leaving the theme’s one alone. Besides, it wouldn’t work in the theme’s function.php because I’m also using define('WP_USE_THEMES', false);, I don’t need my theme on the custom PHP page.

    I love this solution. But…

    I’m putting it in a plugin and I’m concerned that there might be other video content on a user website that should not be modified by my

    add_filter(‘mejs_settings’, ‘add_extra_settings’,9999);

    filter.

    It appears that the add_extra_settings function has no knowledge of which video element it is being applied on.

    Any way to limit the effects of this filter?

    Thread Starter Leandro

    (@leandroprz)

    Doesn’t “mejs_settings” targets only the MediaElement tag?

    Yes.

    However, there could be dozens of them spread throughout a website and my plugin should only react to the specific ones that it “controls”.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Customizing the mediaelement video player’ is closed to new replies.