Tagged: , ,

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #692569

    Hi guys,

    In your documentation you explained how to use video for featured media and how you can display a poster image to be used as featured image for a video. All clear so far.

    At the end of the video, YouTube shows a grid with different video’s. Unfortunately sometimes there are video’s about maritime disasters, which does not really fit my client’s target audience, since he wants to persuade people to join his boat trips :-(

    • Do you happen to know if this is this is a standard YouTube ‘thing’ or maybe coming from my client’s You Tube settings?
    • If it cannot be changed in YouTube settings, is there a way (maybe through function.php?) to show again the poster image also after playing the whole video?

    Please advise.

    Thanks & regards,
    Monique

    #694083

    Hey Monique,

    Are you including it as an iframe? if that’s the case, attach &rel=0 at the end of src:
    <iframe width="500" height="281" src="https://www.youtube.com/embed/Kxy_d-brARA?feature=oembed&wmode=opaque&autoplay=1&rel=0" frameborder="0" allowfullscreen="" wmode="opaque" style="display: block;"></iframe>

    Best regards,
    Josue

    #694731

    Hi Josue,

    No, I am using your theme options “Featured media” to add external video by URL (see screenshot).

    Regards,
    Monique

    #695924

    Hey!

    Please add this in the functions.php file.

    add_action('wp_footer', 'ava_iframe_parameters');
    function ava_iframe_parameters(){
    ?>
    <script>
    (function($){
    	function avia_iframe_parameters_mod(container)
    	{
    		var iframe 	= $('iframe[src*="youtube.com"]', container),
    			youtubeEmbed = $('iframe[src*="youtube.com"] object, iframe[src*="youtube.com"] embed', container).attr('wmode','opaque');
    
    			iframe.each(function()
    			{
    				var current = $(this),
    					src 	= current.attr('src');
    
    				if(src)
    				{
    					if(src.indexOf('?') !== -1)
    					{
    						src += "&autoplay=1&showinfo=1&rel=0";
    					}
    
    					current.attr('src', src);
    				}
    			});
    	}
    
    	avia_iframe_parameters_mod('body');
    })(jQuery);
    </script>
    <?php
    }
    

    Remove browser cache or hard refresh the page.

    Regards,
    Ismael

    #695950

    Hi Ismael,

    Wow, that is amazing :-)

    One little thing though: with this code the music of the video starts playing automatically without pushing the play button. Is there a way to change this so that the music only starts playing together with the video when a visitor clicks the start button?

    Thanks & regards,
    Monique

    #696282

    Hi Monique,

    Try changing autoplay in Ismaels code to 0:

    Change &autoplay=1

    to &autoplay=0

    Regards,
    Rikard

    #704174

    Great Rikard! Works perfect :-)

    Thanks a lot.

    Please flag this topic as solved. Can I do that myself by the way, or do you always have to do that?

    Bye bye,
    Monique

    #704456

    Hi Monique,

    Great, glad you got it working :-)

    I’ll set the topic as solved for you, only moderators can do that.

    Best regards,
    Rikard

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

The topic ‘Question about using video for featured media’ is closed to new replies.