php - Embed video from streamtape using direct link

admin2025-01-07  3

Good Afternoon, i want to embed this video in my wordpress .mp4 Embed code <iframe src=".mp4" width="800" height="600" allowfullscreen allowtransparency allow="autoplay" scrolling="no" frameborder="0"></iframe>

I have tried to paste the following code in my theme function.php file but it doesn't function. I would be very happy to receive your help

add_action( 'init', function()
{        wp_embed_register_handler(
        'streamtape', 
        '#https://streamtape\\/v\/([a-zA-Z0-9_-]+)$#i',   
        'streamtape_embed_handler' 
    );
} );


function streamtape_embed_handler( $matches, $attr, $url, $rawattr )
{
    $embed = sprintf( 
        '<IFRAME SRC="/([a-zA-Z0-9_-]+)$#i" FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=800 HEIGHT=600 allowfullscreen></IFRAME>',
        esc_attr( $matches[1] )
    );
    return apply_filters( 'streamtape_embed_handler', $embed, $matches, $attr, $url, $rawattr );
}
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736252479a48.html

最新回复(0)