Make WordPress Core


Ignore:
Timestamp:
03/07/2015 11:05:57 AM (10 years ago)
Author:
ocean90
Message:

Customizer: Add audio/video previews for upload controls.

props celloexpressions, Fab1en, wonderboymusic.
fixes #30850.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-control.php

    r31539 r31661  
    764764                                <img class="attachment-thumb" src="{{ data.attachment.sizes.full.url }}" draggable="false" />
    765765                            <# } else if ( 'audio' === data.attachment.type ) { #>
    766                                 <img class="attachment-thumb type-icon" src="{{ data.attachment.icon }}" class="icon" draggable="false" />
     766                                <# if ( data.attachment.image && data.attachment.image.src && data.attachment.image.src !== data.attachment.icon ) { #>
     767                                    <img src="{{ data.attachment.image.src }}" class="thumbnail" draggable="false" />
     768                                <# } else { #>
     769                                    <img src="{{ data.attachment.icon }}" class="attachment-thumb type-icon" draggable="false" />
     770                                <# } #>
    767771                                <p class="attachment-meta attachment-meta-title">&#8220;{{ data.attachment.title }}&#8221;</p>
    768772                                <# if ( data.attachment.album || data.attachment.meta.album ) { #>
     
    772776                                <p class="attachment-meta">{{ data.attachment.artist || data.attachment.meta.artist }}</p>
    773777                                <# } #>
     778                                <audio style="visibility: hidden" controls class="wp-audio-shortcode" width="100%" preload="none">
     779                                    <source type="{{ data.attachment.mime }}" src="{{ data.attachment.url }}"/>
     780                                </audio>
     781                            <# } else if ( 'video' === data.attachment.type ) { #>
     782                                <div class="wp-media-wrapper wp-video">
     783                                    <video controls="controls" class="wp-video-shortcode" preload="metadata"
     784                                        <# if ( data.attachment.image && data.attachment.image.src !== data.attachment.icon ) { #>poster="{{ data.attachment.image.src }}"<# } #>>
     785                                        <source type="{{ data.attachment.mime }}" src="{{ data.attachment.url }}"/>
     786                                    </video>
     787                                </div>
    774788                            <# } else { #>
    775789                                <img class="attachment-thumb type-icon" src="{{ data.attachment.icon }}" class="icon" draggable="false" />
Note: See TracChangeset for help on using the changeset viewer.