37378

Custom thumbnail or splash screen for embedded youtube video

Question:

Full Disclosure Confession: This is not a question, but a question with some answers.

I did not initially like the three choices of thumbnails that Youtube.com selected, so ...

<strong>Question</strong>: How do I display a custom thumbnail or splash screen for my embedded youtube video?

<strong>Answer #1</strong>: Accept Monetization option with Youtube.com and a button to create a <strong>custom</strong> thumbnail magically appears. NOTE: this was definitely NOT an acceptable option for me since my Youtube movie, entitled "My Love Song Forever", is a Love Song to my wife (whose lyrics I wrote and whose production I shared in). Have random ads appear together with my Love Song to my bride of over 51 years ... not a chance!!!

<strong>Answer #2</strong>: By pass such a requirement using css and frames:

var videoSrc = "http://www.youtube.com/embed/MxuIrIZbbu0"; var videoParms = "?autoplay=1&amp;fs=1&amp;hd=1&amp;wmode=transparent"; // style of thumbNail's image must equal style of video for the 2 to overlap var youtubeVideo = "" + "<div>" + "<iframe class='ls_video' src='" + videoSrc + videoParms + "'>" + "</iframe>" + "</div>"; var theThumbNail = "" + "<div onclick=\"this.innerHTML = youtubeVideo;\">" + "<img class='ls_video' src='images/MLSFthumbnail.jpg' style='cursor:pointer' alt='splash' \/> " + "</div>"; document.write (theThumbNail);

I read somewhere that the thumbnail should spec at 1280px by 840px, so that is what I did.

IN THE INTEREST OF FULL DISCLOSURE, writing your own custom thumbnail THIS WAY will defeat the natural view counting that Youtube.com keeps track of. View counting will happen ONLY WHEN you go the monetization route.

THE CHOICE IS YOURS.

BOTTOM LINE ... I chose to be concerned about the View Count, so I regretfully chose one of the 3 thumbnail choices that Youtube.com offered;

See --- <a href="http://lovesong.studioaandaonline.com/youtube" rel="nofollow">http://lovesongforever.com</a>

Answer1:

Just copy and paste the code in an HTML file and enjoy the happy coding. Using youtube api to manage the youtubed embedded video thumbnail.

<!DOCTYPE html> <html> <body> <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script> <script> var tag = document.createElement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); var player; function onYouTubeIframeAPIReady() { player = new YT.Player('player', { height: '390', width: '640', videoId: 'M7lc1UVf-VE', events: { 'onReady': onPlayerReady, } }); } function onPlayerReady(event) { $('#play_vid').click(function() { event.target.playVideo(); }); } $(document).ready(function() { $('#player').hide(); $('#play_vid').click(function() { $('#player').show(); $('#play_vid').hide(); }); }); </script> <div id="player"></div> <img id="play_vid" src="YOUR_IMAGE_PATH" /> </body> </html>

Recommend

  • Android: Display image over an Image in ImageView
  • How to add a view on top of UITableView that scrolls together, but stick to top after scrolling
  • Localizing the JFileChooser “All Files” string
  • iAd not showing on Device after releasing application on App Store
  • How can I start a .NET application from Java on Linux, Mac and Windows?
  • PHP - Destroy session if not any action in 10 minutes
  • SQL SELECT to find cyclic references in father-ID-organized tree?
  • Flexbox auto margins don't work with justify-content: center in IE
  • Can I define models in a django project directory?
  • Change scrollviewer template in listbox
  • Auto-configure routes with Zuul and Eureka
  • Getting Spring 4 dependency injection working with RESTeasy 3 validator
  • Failed to sync gradle project (Unknown host 'services.gradle.org')
  • Double data-confirm prompt observed on rails with framework7
  • Error With Dynamically Created SQL Insert statement
  • WooCommerce, how to remove downloadable products permission for order
  • Distributed Cache feature in YARN
  • Google maps error during visualization
  • ClearCase can I use clearexport_ccase/clearimport to copy VOB data to a VOB on a different machine
  • Threads and Concurrent Modification Exception working with a list
  • How to display youtube video on HTML page? [closed]
  • Showing image on a acro text field position
  • Haskell program that can handle any arbitrary deterministic finite automaton
  • Why do you need 2 Javascript files for cross-platform Cordova plugin?
  • C++ Is “const void” As Return Value More Const-Correct Than “void”? [duplicate]
  • Ember.js + JQuery-UI Tooltip - Tooltip does not reflect the model / controller changes
  • Year over Year Stats from a Crossfilter Dataset
  • Ruby regex for matching simpliest Ruby's regexes
  • Why is ordered choice in pyparsing failing for my use case?
  • r - input value by user to dataframe via shiny
  • I am consuming a WCF service that requires headers from a .NET 2 website. How can I programmatically
  • How to turn off notice reporting in xampp?
  • Google App Engine Datastore: Dealing with eventual consistency
  • How to encrypt Connectionstring written in web.config from codebehind?