WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] New 3.6 Audio/Video Shortcodes (8 posts)

  1. claregoult
    Member
    Posted 1 year ago #

    Adding video and audio via the 'Add Media' button is glitchy. If you insert a video or audio shortcode it doesn't display, unless you also upload and insert a similar file.

    If you insert a video already in the Media Library and then upload and insert an audio file, the audio would display but not the video. To get the video shortcode to display you have to upload a video file (you don't have to insert it, just upload it) on the same post/page.

    If you had a page of videos and audios then you would have to upload an audio and video file for them all to be displayed. They don't have to be the same format though, as when I uploaded a .MOV file all the .M4Vs loaded.

    Additionally, when I inserted a .MOV file (recorded for testing purposes via QuickTime) it just inserted an empty video shortcode tag (i.e. [video][/video]', rather than than degrading to a flash player or something if unsupported. I don't know if there is a flash fallback in place but I assumed so as on the Twenty Thirteen demo site the audio file is displaying via a flash player.

  2. claregoult
    Member
    Posted 1 year ago #

    Removing lines 877-888 of the wp_audio_shortcode function and 995-1006 of wp_video shortcode (in wp-includes/media.php) seems to solve the problem.

    The problem seems to be that the $audios variable is just an empty array because if you don't have any audio files attached to that post/page then no audio shortcodes will display, same for video. That is, if nothing is attached then get_attached_audio/video fails and it breaks the entire shortcode.

  3. Adding video and audio via the 'Add Media' button is glitchy. If you insert a video or audio shortcode it doesn't display, unless you also upload and insert a similar file.

    I'm not entirely sure I'm doing what you're doing.

    I have a video on my blog already. It is NOT attached to any post. I make a new post. I click 'Add Media' and add it to a post. Short code added. Video works.

  4. claregoult
    Member
    Posted 1 year ago #

    That does work (if you do it via the Media tab and 'Add New').

    If you click 'Add Media' on a new post, go to 'Upload Files', upload a file and insert it into the post, that also works. However, if you try to attach that same uploaded video to another post or a page then it doesn't - unless you then upload another video to that post/page (but don't necessarily have to insert it, just so it has an attached video).

    That is to say, if you have a post full of video shortcodes that were uploaded on other posts then they won't show up, unless you attach a video to the post with all the video shortcodes.

    (I should note that the shortcodes do get inserted. They just don't display.)

  5. However, if you try to attach that same uploaded video to another post or a page then it doesn't

    Are you really attaching these videos or are you just adding in the shortcode? Because for me, just tossing in the shortcode, with no attachments on the page, works fine.

  6. claregoult
    Member
    Posted 1 year ago #

    Originally, I uploaded a video while in a post to via the 'Add Media' button to try out new shortcodes (thereby attaching that video to the post). Then when I tried inserting that same video later (even by just copying and pasting the shortcode) into another post it failed to display. If you upload a video via 'Add New Media' (under the Media menu) or presumably link to an external link then it works fine (like you're trying).

    The problem is that if the video/audio is attached to another post (that is, was uploaded whilst in another post/page to the one you're trying to add it to) then it doesn't display on the post/page — unless you then attach another video/audio file to that post/page.

  7. The problem is that if the video/audio is attached to another post (that is, was uploaded whilst in another post/page to the one you're trying to add it to) then it doesn't display on the post/page — unless you then attach another video/audio file to that post/page.

    Right, THAT I cannot reproduce. I have an mp4 attached to post 1. Shortcode works. I copy the shortcode (or use Add Media) for post 2. Same video shows.

    Nothing is attached to post 2.

  8. Sergey Biryukov
    WordPress Dev
    Posted 11 months ago #

Topic Closed

This topic has been closed to new replies.

About this Topic