Web Info & Tutorials

March 12th, 2008

YTRANSCRIPT: USING THE BRAND NEW YOUTUBE CHROMELESS, SCRIPTABLE PLAYER

We saw a very exciting YouTube launch for developers today. People have long wanted to customize the YouTube player, and now you have complete control with a chromeless player that has JavaScript access so you can start, stop, go to a timing, and much more.

I took this API and implemented a simple DSL that allows me to build a simple transcript table of contents that lets you jump to a particular chapter in the video.

The HTML has special attributes and CSS classes, ending up like this:

HTML:
  1.  
  2. <div id="ytplayer" class="ytplayer" url="http://www.youtube.com/v/2SgMHjmZO60"></div>
  3.  
  4. <div id="ytranscript" class="ytranscript" for="ytplayer">
  5. <b>Click on the item you want to skip too</b>
  6. <li starttime="0.0">Hand, hand, fingers, thumb</li>
  7. <li starttime="8.0">Drumming and drumming</li>
  8. <li starttime="28.0">Time to pick the apples and the plums</li>
  9. <li starttime="42.0">Enter Jake</li>
  10. <li starttime="44.0">Enter Jack</li>
  11. <li starttime="51.0">The monkeys say bye bye</li>
  12.  
  13. <li starttime="60.0">Now they play bangos and fiddles</li>
  14. <li starttime="78.0">Wooah, millions of monkeys!</li>
  15. </ul>
  16. </div>
  17.  

My JavaScript trivially attaches behaviour to the list to talk to the player. It adds timing information from the DSL to the HTML content, and uses seekTo to get the player to the point you need.

JAVASCRIPT:
  1.  
  2. window.onload = function() {
  3.   $$('.ytranscript').each(function(e) {
  4.     var player = e.readAttribute("for");
  5.     var playerEmbed = player + "Embed";
  6.     initPlayer(player, playerEmbed);
  7.    
  8.     var lis = e.getElementsByTagName("li");
  9.     var odd = 1;
  10.     $A(lis).each(function(li) {
  11.       var starttime = li.readAttribute('starttime');
  12.       li.innerHTML = li.innerHTML + " <span class='timing'>" + parseInt(starttime) + " secs</span>";
  13.       li.addClassName( (odd++ % 2) ? "odd" : "even");
  14.       li.writeAttribute("title", "Send the player to this location");
  15.       li.onclick = function() {
  16.         makeSureVideoIsPlaying($(playerEmbed));
  17.         $(playerEmbed).seekTo(starttime, true);
  18.       };
  19.     });
  20.   });
  21. }
  22.  
  23. function makeSureVideoIsPlaying(playerEmbed) {
  24.   if (playerEmbed.getState && $(playerEmbed).getState() == -1) { // -1 unstarted
  25.     playerEmbed.playVideo(); // play if we haven't started
  26.   }
  27. }
  28.  
  29. function initPlayer(player, playerEmbed) {
  30.   var url = $(player).readAttribute('url');
  31.   var so = new SWFObject(url + "&enablejsapi=1&playerapiid=my" + playerEmbed, playerEmbed, 432, 400, 8);
  32.   so.addParam("AllowScriptAccess", "always");
  33.   so.write(player);
  34. }
  35.  
  36. function onYouTubePlayerReady(playerId) {}
  37.  

The one gotcha is that seekTo goes to the nearest keyframe, which can be a few seconds off. Hopefully it will at least go to the nearest one before the timing, but that isn't the case right now.

Learn more

We have an interview with the engineers, and a bunch of documentation.


Check out the JavaScript API and chromeless player reference to find out more.

UPDATE: Christian Heilmann has written a video captioning system that lets you annotate as you pause.

March 12th, 2008

WISEMAPPING: MORE AJAX MIND MAPPING

WiseMapping is the latest Ajax mind mapping tool developed by Paulo Veiga and three friends.

Wise Mapping is a free web mind mapping tool that leverages the power of Mind Maps mixing new technologies like vectorial languages (SVG and VML) and the power of the whole Web 2.0 concept. The tools uses SVG and VML which allows straightforward vector graphics animation without the need of installing any plug-in.

We asked Paulo about the development experience.

The main challenge was to develop an abstraction layer between SVG and VML (there was no open source framework to do this at the time we started working on the project) in order to support multiple browsers such as IE and Firefox/Opera (some efforts are being made at the moment to support Safari 3.0.4+). Using this layer for the core for the client side, a very intuitive, simple, nice looking, full Drag and Drop enabled graphical mind map editor is provided.

All the UI is powered by Mootools using DWR for the Ajax interaction with a backend made with Java 1.6 with Web Spring for MVC layer and Hibernate.

There have been some reports that VML is broken on IE 8. Hopefully this is a beta 1 bug, as without that legacy support, a bunch of applications (including this one) will not work.

There seem to be many mind mapping tools in Ajax, second only to RSS readers.

WiseMapping

March 12th, 2008

RADRAILS 1.0 RELEASED

Aptana took over the RadRails open source project a few months back, and now have fully integrated it with Aptana Studio with the RadRails 1.0 release.

RadRails 1.0 runs as a plug-in to Aptana Studio. So in addition to all the Ruby on Rails IDE goodies and the integrated Rails shell command-line console, developers get the great HTML, CSS, DOM, JavaScript and Ajax features in Aptana Studio, which can run stand alone or within Eclipse to that all your other Eclipse tools can be right there as well.

The new version has a slew of new and enhanced functionality such as:

  • Rails 2.0 support
  • JRuby support
  • Bundled auto-installing gems for rails development
  • A Ruby profiler for Pro users
  • An RDoc preview view
  • Extended RHTML/ERb color preferences
  • Code completion for ActiveRecord model fields and finders
  • Code completion suggesting method call arguments
  • Significant expansion of code warnings and analysis, including syntax changes from Ruby 1.8 to 1.9
  • An improved look and feel

You can watch a screencast of the product at work or a full feature list.

Aptana continues to add new functionality to its products as it tries to hit the "best tools for Web development with scripting languages" vision.

March 12th, 2008

CLIENTSIDE MOOTOOLS LIBRARY UPDATE

Aaron Newton of CNet has posted an update for his Clientside Mootools library:

We’ve refactored nearly the entire library and in most cases the changes don’t affect the actual interface to the classes and methods, but not always. Like Mootools, you can download a compatibility layer which will preserve the old syntax if you have code that you haven’t updated yet.

The most interesting changes are as follows:

  • Fx.SmoothShow/SmoothHide is now Fx.Reveal, Element.reveal(), and Element.dissolve()
  • Fx.SmoothMove is now just Fx.Move and Element.move()
  • stickyWinHtml() is now StickyWin.ui()

There are other changes, but these 3 are the big name changes. You can browse the Compatibility files and see the actual changes if you want to compare, but other than that all the new details are in the docs. Speaking of which…

You can check out the new documentation and fancy new download page.

March 12th, 2008

GREEN ISSUES MOVE UP THE AGENDA AT BANKS

Following a showdown with Ethical Funds Co., Bank of metropolis plans to discourse its procedures for evaluating assign venture related with status modify by April. via Globeinvestor.com