New Landing How can we help? Cardinal Fullscreen video button shortcode doesn't support timestamp forwarding

Viewing 4 posts - 1 through 4 (of 4 total)
  • Posted in: Cardinal
  • #238965
    WEswift
    Member
    Post count: 234

    Hey Team, the fullscreen video feature is pretty sweet. And it does work perfect for typical Vimeo video display. However, I need to be able to utilize the “start playing from a specific time” feature of a Vimeo video like such: https://vimeo.com/138992890#t=11m43s

    This kind of link works fine as a standard text link, but not as part of the fullscreen button. Note the additional info after the # sign. Is there a way to incorporate this in the fullscreen button link? I’m currently using the following shortcode:

    [sf_fullscreenvideo type="text-button" btntext="Barbara Harness" imageurl="" videourl="https://vimeo.com/138992890#t=11m43s" extraclass="button-video-plaintext"]

    The class I’ve added merely changes the button style. Thoughts? Any help would be greatly appreciated. Thanks in advance!

    #239090
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please paste this code functions.php of child theme.

    function sf_get_embed_src( $url ) {
                if ( strpos( $url, 'youtube' ) ) {
                    preg_match( '/[\\?\\&]v=([^\\?\\&]+)/', $url, $video_id );
                    $youtube_params = apply_filters( 'sf_youtube_embed_src_params', '?autoplay=1' );
                    if ( is_ssl() ) {
                        if ( isset( $video_id[1] ) ) {
                            return 'https://www.youtube.com/embed/' . $video_id[1] . $youtube_params;
                        }
                    } else {
                        if ( isset( $video_id[1] ) ) {
                            return 'http://www.youtube.com/embed/' . $video_id[1] . $youtube_params;
                        }
                    }
                } else {
                    $url          = str_replace( 'https://', 'http://', $url );
                    $video_id     = sf_get_vimeoid( $url );
                    $time_stamp = explode('#',$url);
                    $video_id  = (!empty($time_stamp[1]))?$video_id.'#'.$time_stamp[1]:$video_id
                    $vimeo_params = apply_filters( 'sf_vimeo_embed_src_params', '?title=0&byline=0&portrait=0&autoplay=1' );
                    if ( is_ssl() ) {
                        if ( $video_id != "" ) {
                            return 'https://player.vimeo.com/video/' . $video_id . $vimeo_params;
                        }
                    } else {
                        if ( $video_id != "" ) {
                            return 'http://player.vimeo.com/video/' . $video_id . $vimeo_params;
                        }
                    }
                }
            }

    Thanks
    Mohammad

    #239200
    WEswift
    Member
    Post count: 234

    Mohammed – thanks for the assist! This function does work a treat – but for any future users out there, the code was a missing ; on line 18. Might this get added to the base Cardinal theme going forward?

    #239443
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    You most welcome and glad to help you.
    Thanks
    Mohammad

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.