• I’m trying to use this to play an mp4 file. I do want it to preload, but do not want it to autoplay. I set the autoplay attribute to false (autoplay=”false”), but it’s apparently being ignored by all the browsers I’ve tried. So is preload, for that matter; it will preload whether I set the attribute to “true” or “false”, but I’m fine with preloading. Also, is there a way to set the default volume so it’s not at 100%?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author johndyer

    (@johndyer)

    The preload value should be “none”.

    I’ll take a look at the autoplay option.

    I’m having the same problem with my MP3 files autoplaying regardless of what I try to include to stop them. Help?

    I have the same issue on videos with it just playing… even when auto play is set to false. Did anyone get this resolved… I would like to start using this plugin.

    I found if I edited the plugin’s code I could fix the autoplay issue.
    Under “media_shortcode($tagName, $atts)”

    Change the preload and autoplay to this. Making them equal to empty values by default. Even having false in there causes the options to get added to any video when not specified.

    ‘preload’ => ”,
    ‘autoplay’ => ”,

    John, can you comment on George’s find? I’d like to hear an “official” position on this hack, though it sounds like it might do the trick?

    I am not an “official” voice for the plug in, but I do understand why @georgestarcher edit worked… I believe the proper way to fix this is to edit the following lines in the mediaelement-js-wp.php file (lines 177, 178, and 179):

    'preload' => 'false',
    'autoplay' => 'false',
    'loop' => 'false',

    To

    'preload' => false,
    'autoplay' => false,
    'loop' => false,

    What is happening here is that the code below this array, lines 188 through 238, is looking to see if the variables are true or not. If they are true then they set the option. The problem with the code is that the array defaults are set to strings instead of a bool. Therefore the variable, set as a string to false, is always true. So if you were to not put any argument into the short code then the default would be used, which in this case is ‘false’ as a string. Well the code below the array is looking to see if that variable is defined, which it is, therefore the if statement is true so it then defines the option/attribute. Therefore by removing the quotes in the code around the ‘false’ will change it to a bool default. In fact, the defaults of:

    'duration' => 'true',
    'progress' => 'true',
    'fullscreen' => 'true',
    'volume' => 'true',

    Should also have the quotes removed under this same theory.

    Thanks! Those edits work great for me.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: MediaElement.js – HTML5 Video & Audio Player] Autoplaying even set to "false"’ is closed to new replies.