+ /**
+ * Create an Audio shortcode string that is suitable for passing to the editor
+ *
+ * @param {Object} props Attachment details (align, link, size, etc).
+ * @param {Object} attachment The attachment object, media version of Post.
+ * @returns {string} The audio shortcode
+ */
+ audio: function( props, attachment ) {
+ return wp.media.string._audioVideo( 'audio', props, attachment );
+ },
+ /**
+ * Create a Video shortcode string that is suitable for passing to the editor
+ *
+ * @param {Object} props Attachment details (align, link, size, etc).
+ * @param {Object} attachment The attachment object, media version of Post.
+ * @returns {string} The video shortcode
+ */
+ video: function( props, attachment ) {
+ return wp.media.string._audioVideo( 'video', props, attachment );
+ },
+ /**
+ * Helper function to create a media shortcode string
+ *
+ * @access private
+ *
+ * @global wp.shortcode
+ * @global wp.media.view.settings
+ *
+ * @param {string} type The shortcode tag name: 'audio' or 'video'.
+ * @param {Object} props Attachment details (align, link, size, etc).
+ * @param {Object} attachment The attachment object, media version of Post.
+ * @returns {string} The media shortcode
+ */
+ _audioVideo: function( type, props, attachment ) {
+ var shortcode, html, extension;
+
+ props = wp.media.string.props( props, attachment );
+ if ( props.link !== 'embed' )
+ return wp.media.string.link( props );
+
+ shortcode = {};
+
+ if ( 'video' === type ) {
+ if ( attachment.image && -1 === attachment.image.src.indexOf( attachment.icon ) ) {
+ shortcode.poster = attachment.image.src;
+ }
+
+ if ( attachment.width ) {
+ shortcode.width = attachment.width;
+ }
+
+ if ( attachment.height ) {
+ shortcode.height = attachment.height;
+ }
+ }
+
+ extension = attachment.filename.split('.').pop();
+
+ if ( _.contains( wp.media.view.settings.embedExts, extension ) ) {
+ shortcode[extension] = attachment.url;
+ } else {
+ // Render unsupported audio and video files as links.
+ return wp.media.string.link( props );
+ }
+
+ html = wp.shortcode.string({
+ tag: type,
+ attrs: shortcode
+ });