Skip to content

Commit d61178e

Browse files
committed
Add shortcode support for local audio described video.
1 parent c259108 commit d61178e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/ableplayer.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ function ableplayer_shortcode( $atts, $content = null ) {
400400
'vimeo-id' => '',
401401
'vimeo-desc-id' => '',
402402
'media-id' => '',
403+
'media-desc-id' => '',
403404
'captions' => '',
404405
'subtitles' => '',
405406
'descriptions' => '',
@@ -439,6 +440,14 @@ function ableplayer_shortcode( $atts, $content = null ) {
439440
$source = '<source type="' . esc_attr( $type ) . '" src="' . esc_url( $media_id ) . '">';
440441
}
441442
}
443+
if ( $all_atts['media-desc-id'] ) {
444+
// If Video ID is set but is not a valid URL, return.
445+
$media_desc_id = ( is_numeric( $all_atts['media-desc-id'] ) ) ? wp_get_attachment_url( $all_atts['media-desc-id'] ) : $all_atts['media-desc-id'];
446+
if ( $media_desc_id ) {
447+
$type = get_post_mime_type( $media_desc_id );
448+
$source = '<source data-desc-src type="' . esc_attr( $type ) . '" src="' . esc_url( $media_desc_id ) . '">';
449+
}
450+
}
442451

443452
$tracks = array();
444453
$kinds = array(

0 commit comments

Comments
 (0)