Skip to content

Commit 94e2f8e

Browse files
committed
Account for videos (amp-video) that have <source> tags
1 parent ca6fa54 commit 94e2f8e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

php/media/class-video.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public function filter_video_shortcode( $html, $attr ) {
256256
*/
257257
public function filter_video_tags( $content ) {
258258

259-
$video_tags = $this->media->filter->get_media_tags( $content, 'video' );
259+
$video_tags = $this->media->filter->get_media_tags( $content, 'video|source' );
260260
foreach ( $video_tags as $tag ) {
261261
$args = array();
262262

@@ -282,7 +282,10 @@ public function filter_video_tags( $content ) {
282282
}
283283
$attachment_id = $this->media->filter->get_id_from_tag( $tag );
284284
if ( empty( $attachment_id ) ) {
285-
continue; // Missing or no attachment ID found.
285+
$attachment_id = attachment_url_to_postid( $url );
286+
if ( ! $attachment_id ) {
287+
continue; // Missing or no attachment ID found.
288+
}
286289
}
287290
// Enable Autoplay for this video.
288291
if ( false !== strpos( $tag, 'autoplay' ) ) {

0 commit comments

Comments
 (0)