WordPress.org

Making WordPress.org

Ticket #1375: meta-1375.diff

File meta-1375.diff, 1.6 KB (added by kraftbj, 4 years ago)

Set og:video tags to mp4

  • wordpress.tv/public_html/wp-content/themes/wptv2/plugins/wordpresstv-twitter-cards/wordpresstv-twitter-cards.php

     
    2727        // Add the tags necessary for the player
    2828        $video_info = video_get_info_by_guid( $video_id[0] );
    2929        list( $width, $height ) = wp_expand_dimensions( $video_info->width, $video_info->height, 560, 315 );
     30        $mp4_url = set_url_scheme( wp_get_attachment_url( $video_info->post_id ), 'https' );
    3031
    3132        $og_tags['twitter:card']                       = 'player';
    3233        $og_tags['twitter:player']                     = sprintf( 'https://videopress.com/v/%s?autoplay=0', $video_id[0] );
    3334        $og_tags['twitter:player:width']               = $width;
    3435        $og_tags['twitter:player:height']              = $height;
    35         $og_tags['twitter:player:stream']              = wp_get_attachment_url( $video_info->post_id );
     36        $og_tags['twitter:player:stream']              = $mp4_url;
    3637        $og_tags['twitter:player:stream:content_type'] = 'video/mp4';
     38        // Filters OG tags pending WPCOM fix. See https://meta.trac.wordpress.org/ticket/1375 and https://github.com/Automattic/jetpack/issues/2950
     39        $og_tags['og:video:type']                      = 'video/mp4';
     40        $og_tags['og:video']                           = $mp4_url;
     41        $og_tags['og:video:secure_url']                = $mp4_url;
    3742
    3843        return $og_tags;
    3944}