update the youtube video embed method for upfront

Upfront has a really great way of embedding the video links, but the final output does the standard youtube embed….which loads a TON of stuff that is not necessary.

Please review this example asap of just loading the thumnail and then when the user clicks on the thumbnail it dynamically loads and plays the video.

http://jsfiddle.net/me6ahg6h/

HTML

<div id="ytvideo1" style="display:none;">
<iframe width="939" height="528" id="ytvideo" frameborder="0" allowfullscreen></iframe>
</div>

<img class="preload aligncenter size-full" id="homevideo" alt="placeholder" src="https://img.youtube.com/vi/DBNYwxDZ_pA/sddefault.jpg" width="940" height="548" data-vid='DBNYwxDZ_pA'/>
<button class="preload" style="text-align: center; top: -200px; left: 100px; right: 0px; width: 300px; background-color: red; height: 30px; color: white; position: relative;" data-vid='DBNYwxDZ_pA'>Play</button>

JAVASCRIPT

jQuery(document).one('click','.preload',function(e){
jQuery('#ytvideo1').show();
jQuery('.preload').hide();
jQuery('#ytvideo').attr("src","http://www.youtube.com/embed/"+$(this).data('vid')+"?autoplay=1");
});

Developer could easily integrate this code and then all sites with youtube embeds would load much faster to delight of viewers and google page rank.

This is some very low hanging fruit for the developer to implement!

-Ben

  • Nithin
    • Support Wizard

    Hi Ben,

    The current Youtube element loads many options which many users might find it necessary, even it does comes with a fallback if the player is not available. Thank you for creating a feature request, and sharing your code, however you can always implement it using the Code element, and selecting Embed 3rd Party Code as it’s option.

    If more users find this code to be handy, and more +1 this thread receives the more it’ll be considered for Upfront. Have a nice weekend. :slight_smile:

    Kind Regards,

    Nithin

  • Ben
    • The Reaper

    The current Youtube element loads many options which many users might find it necessary,

    Your response makes no sense.

    Thank you for creating a feature request, and sharing your code, however you can always implement it using the Code element, and selecting Embed 3rd Party Code as it’s option.

    The point of my post was to help upfront spit out improved code over what is there now.

    I’m afraid your not understanding what I posted, the code is to help the developer, forward to him or her.

  • Rupok
    • Support Ninja

    Hi Ben,

    I’m so sorry for the inconvenience you have had. From now on, I will forward your coding suggestions to our developers and will update you what I get from them. I’m also suggesting this to my colleagues.

    Thanks again for your suggestions. I really appreciate this.

    Have a nice day. Cheers!

    Rupok

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.