New Landing How can we help? Atelier YouTube Views not counting because Fullscreen Video autoplays

Viewing 2 posts - 1 through 2 (of 2 total)
  • Posted in: Atelier
  • #239197
    parcyvall
    Member
    Post count: 143

    Dear Swiftideas,

    I just noticed that now views are counted for videos on the site using the fullscreen video overlay. This seems to be, because YouTube doesn’t count autoplays anymore.

    Is there a way to stop the videos from autoplaying?

    Kind regards,
    Simon

    #239448
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please paste this code at 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=0' );
                    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 );
                    
                    $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

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

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register