• Resolved Ben

    (@runpixelrun)


    There’s an issue I’m seeing on a few customer sites, but can’t replicate on others nor our own, where it seems the media-audiovideo.js file is not being included or enqueued and then causes “Uncaught TypeError: wp.media.mixin is undefined” error when an image is selected in the media library, leaving the “Use this image” button disabled.

    We have a Gravity Forms addon we’ve developed (it’s not here in the WordPress repo), which makes use of the media library and correctly calls wp_enqueue_media(); from within a ‘admin_enqueue_scripts’ action handler.

    It seems everything else enqueued by wp_enqueue_media loads fine but for some reason not media-audiovideo.js specifically. There’s no script tag for it on page. The file exists and isn’t corrupted, and is present for example when editing a normal post. Just cannot figure out why.

    Wondering (hoping!) somebody here might have an idea why.

    As mentioned this doesn’t happen across the board, but it is recent and we’ve had it reported a handful of times over the last two weeks. The most recent case, the user had a fresh WordPress install, and the only plugins were Gravity Forms and our addon. The theme was Twenty Twenty One. I’ve tried the same setup but it works fine.

    Can anybody help shed some light? ????

Viewing 5 replies - 1 through 5 (of 5 total)
  • Did you already try this :

    function load_wp_media_files() {
        wp_enqueue_media();
    }
    add_action( 'admin_enqueue_scripts', 'load_wp_media_files' );

    This way it will be agnostic if there is a conflict with your custom addOn.
    Secondly you could try to call the file using NoConflict :
    https://api.jquery.com/jquery.noconflict/

    Lastly, I would ask the users what browser they are using – see if there is a pattern there.

    Thread Starter Ben

    (@runpixelrun)

    Thanks, yes that’s exactly how we’re already calling wp_enqueue_media and I’ve confirmed it’s not browser. Happens across multiple browsers on the sites where this issue occurs. As noted, the error is being thrown because that one specific javascript file isn’t even being included on the page, but everything else enqueued by that wp_enqueue_media function is.

    > the error is being thrown because that one specific javascript file isn’t even being included on the page

    Just load it old school then? Hard-coded, and directly in the template?

    Did you take a look through your php or apache logs?

    Thread Starter Ben

    (@runpixelrun)

    Found this issue. It’s actually the No Conflict Mode setting in Gravity Forms that stops this script from being enqueued.

    Thread Starter Ben

    (@runpixelrun)

    Will resolved with GF

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp.media.mixin in undefined error (media-audiovideo.js not loaded)’ is closed to new replies.