BP_REST_Media_Endpoint::bp_rest_media_forums_embed_gif( integer $id )

Get Gif data.

Description

Parameters

$id

(Required) Forum/Topic/Reply Id.

Return

(false|string|void)

Source

File: bp-media/classes/class-bp-rest-media-endpoint.php

2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
protected function bp_rest_media_forums_embed_gif( $id ) {
    $gif_data = get_post_meta( $id, '_gif_data', true );
 
    if ( empty( $gif_data ) ) {
        return;
    }
 
    $preview_url = wp_get_attachment_url( $gif_data['still'] );
    $video_url   = wp_get_attachment_url( $gif_data['mp4'] );
 
    return '<div class="activity-attached-gif-container">' .
        '<div class="gif-image-container">' .
            '<div class="gif-player">' .
                '<video preload="auto" playsinline poster="' . esc_url( $preview_url ) . '" loop muted playsinline>' .
                    '<source src="' . esc_url( $video_url ) . '" type="video/mp4">' .
                '</video>' .
                '<a href="#" class="gif-play-button">' .
                    '<span class="dashicons dashicons-video-alt3"></span>' .
                '</a>' .
                '<span class="gif-icon"></span>' .
            '</div>' .
        '</div>' .
    '</div>';
}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.