+ audio: function( props, attachment ) {
+ return wp.media.string._audioVideo( 'audio', props, attachment );
+ },
+
+ video: function( props, attachment ) {
+ return wp.media.string._audioVideo( 'video', props, attachment );
+ },
+
+ _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.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
+ });
+
+ return html;
+ },
+