WordPress.org

Forums

MediaElement.js - HTML5 Video & Audio Player
Video failing to load using shortcode and (2 posts)

  1. John Chandler
    Member
    Posted 3 years ago #

    I'm trying to use this plugin to embed a video that is attached to a custom post type.

    This is the code that isn't working:

    <?php echo $video_link; ?>
    <?php echo do_shortcode('[video src=" ' . $video_link . ' "]'); ?> // spaces between quotes to help differentiate them

    The $video_link is being defined from the post meta in previous code and the first echo command is returning the proper URL to the .mp4 file. The second line isn't properly loading the video in the player. When I view the HTML source of the page, the player is showing src="" so I figure either I have a syntax issue with my php, or the plugin isn't properly reading the shortcode. Thoughts?

    (And, for what it's worth, if I replace the ' . $video_link . ' in that second line with a direct URL to one of the videos, it loads just fine.)

    http://wordpress.org/extend/plugins/media-element-html5-video-and-audio-player/

  2. akyusa01
    Member
    Posted 2 years ago #

    not sure if anyone is looking for a solution but this was mine (for audio files):

    <?php echo do_shortcode('[audio src="' . get_post_meta($post->ID, 'audiourl', $single = true) . '"] ' ); ?>

    hope this helps someone! :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • MediaElement.js - HTML5 Video & Audio Player
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic