File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 454454
455455 $source = '';
456456 $datasource = '';
457+ $element = 'video';
457458 if ( ! ( $all_atts['youtube-id'] || $all_atts['vimeo-id'] || $all_atts['media-id'] ) ) {
458- // Shortcode must have one of YouTube, Vimeo, or local video source.
459+ // Shortcode must have one of YouTube, Vimeo, or a local source.
459460 return false;
460461 } else {
461462 if ( $all_atts['media-id'] ) {
464465 if ( ! $media_id ) {
465466 return false;
466467 } else {
467- $type = get_post_mime_type( $all_atts['media-id'] );
468- $type = ( 'video/quicktime' ) ? 'video/mp4' : $type;
469- $source = '<source type="' . esc_attr( $type ) . '" src="' . esc_url( $media_id ) . '"%datasrc%> ' . PHP_EOL;
468+ $type = get_post_mime_type( $all_atts['media-id'] );
469+ $type = ( $type === 'video/quicktime' ) ? 'video/mp4' : $type;
470+ $element = ( wp_attachment_is( 'audio', $all_atts['media-id'] ) ) ? 'audio' : 'video';
471+ $source = '<source type="' . esc_attr( $type ) . '" src="' . esc_url( $media_id ) . '"%datasrc%> ' . PHP_EOL;
470472 }
471473 }
472474 if ( $all_atts['media-desc-id'] ) {
517519 }
518520
519521 // build a video player.
520- $o = ' <video ' ;
522+ $o = " <$element " ;
521523 $o .= ' id="' . esc_attr( $all_atts['id'] ) . '"';
522524 $o .= ' data-able-player';
523525 if ( ableplayer_is_true( $all_atts['autoplay'] ) ) {
600602 }
601603
602604 // end media tag.
603- $o .= PHP_EOL . ' </video > ' ;
605+ $o .= PHP_EOL . " </$element > " ;
604606
605607 return $o;
606608 }
You can’t perform that action at this time.
0 commit comments