<p>I want to be able to display a normal YouTube video with overlaid annotations, consisting of coloured rectangles for each frame. The only requirement is that this should be done programmatically. </p>

<p>YouTube has annotations now, but require you to use their front end to create them by hand. I want to be able to generate them. What's the best way of doing this?</p>

<p>Some ideas:</p>

<blockquote>
  <ol>
  <li>Build your own Flash player (ew?)</li>
  <li>Somehow draw over the YouTube Flash player. Will this work?</li>
  <li>Reverse engineer &amp; hijack YouTube's annotation system. Either messing with the local files or redirecting its attempt to download
  the annotations. (using Greasemonkey? Firefox plugin?)</li>
  </ol>
</blockquote>

<p>Idea that doesn't count: </p>

<blockquote>
  <p>download the video</p>
</blockquote>

[{'answer_id': 7157, 'author': 'grapefrukt', 'author_id': 914, 'author_profile': 'https://Stackoverflow.com/users/914', 'pm_score': 3, 'selected': False, 'text': '<p>The player itself has a <a href="http://code.google.com/apis/youtube/js_api_reference.html" rel="noreferrer">Javascript API</a> that might be useful for syncing the video if you choose to make your own <code>annotation-thingamajig</code>.</p>\n'}, {'answer_id': 65659, 'author': 'nerdabilly', 'author_id': 8349, 'author_profile': 'https://Stackoverflow.com/users/8349', 'pm_score': 4, 'selected': False, 'text': '<p>YouTube provides an <a href="http://code.google.com/apis/youtube/flash_api_reference.html" rel="noreferrer">ActionScript API</a>.</p>\n\n<p>Using this, you could load the videos into Flash using their API and then have your Flash app create the annotations on a layer above the video. </p>\n\n<p>Or, alternatively, if you want to stay away from creating something in Flash, using YouTube\'s JavaScript API you could draw HTML DIVs over the YouTube player on your web page. Just remember when you embed the player to have <code>WMODE="transparent"</code> in the params list. </p>\n\n<p>So using the example from YouTube:</p>\n\n<pre><code>  &lt;script type="text/javascript"&gt;\n\n    var params = { allowScriptAccess: "always" };\n    var atts = { id: "myytplayer", wmode: "transparent" };\n    swfobject.embedSWF("http://www.youtube.com/v/VIDEO_ID&amp;enablejsapi=1&amp;playerapiid=ytplayer", \n                       "ytapiplayer", "425", "356", "8", null, null, params, atts);\n\n  &lt;/script&gt;\n</code></pre>\n\n<p>And then you should be able to draw your annotations over the YouTube movie using CSS/DHTML. </p>\n'}, {'answer_id': 106818, 'author': 'marstonstudio', 'author_id': 19447, 'author_profile': 'https://Stackoverflow.com/users/19447', 'pm_score': 3, 'selected': False, 'text': '<p>Joe Berkovitz has written a sample application called <code>ReviewTube</code> which "Allows users to create time-based subtitles for any YouTube video, a la closed captioning. These captions become publicly accessible, and visitors to the site can browse the set of videos with captions. Think of it as a “subtitle graffiti wall” for YouTube!"</p>\n\n<p>The app is the example used to demonstrate the MVCS framework/approach for building Flex applications.</p>\n\n<p><a href="http://www.joeberkovitz.com/blog/reviewtube/" rel="noreferrer">http://www.joeberkovitz.com/blog/reviewtube/</a></p>\n\n<p>Not sure if this will help with the colored rectangles and whatnot, but it\'s a decent place to start.</p>\n'}]
['https://Stackoverflow.com/questions/175', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2089740/']