• Hi, I have an ACF field to paste a Youtube video which is then displayed on a page. No thumbnail is displayed and when hovering the video, the play button becomes red (https://ibb.co/cbKbqHW). Once I click the video, a Youtube error “Please click here to watch this video on YouTube.” is displayed (https://ibb.co/CWqkLQb)

    After clicking the play button, the following error appears in the console https://ibb.co/ScGTSF0

    • Youtube API key seems fine and working.
    • ACF field is delivering a Youtube ID

    What I would like to see?
    -> The video to be loaded and play as well as a thumbnail being displayed, so that the video only loads after a click on the thumbnail.

    How could I make it work?

    The code to display the videos:

    <?php
    	$video = get_field( "youtube_video" );
    	$featured_img = wp_get_attachment_url( get_post_thumbnail_id($post->ID), 'thumbnail' );
    
    	if( get_field('youtube_video') ) {
    		if ( function_exists('lyte_preparse') ) {
          		echo lyte_preparse($video);
        	}
    	} else {
          echo '<img src="'.$featured_img.'" alt="VECUB AG">';
        }
    ?>

    Thanks

    • This topic was modified 4 years, 6 months ago by Johannes.
    • This topic was modified 4 years, 6 months ago by Johannes.
    • This topic was modified 4 years, 6 months ago by Johannes.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    so before going into your code: does LYTE work for you when adding a youtube URL to a normal post?

    Thread Starter Johannes

    (@fumow)

    Thanks for getting back so quickly. Yes, I have added a shortcode to another post and the video is being displayed.

    Somehow my video is playing now, that literally changed over night. It might had to do with the API key, but I’m not certain.

    Just the thumbnails are not showing yet. I can still start the video with one click.

    I’ve tried switching the HD settings, no success. Also I’m not using any caching plugins.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Video not playing, Youtube error’ is closed to new replies.