HTML Timing
By Kazé on Thursday, August 26 2010, 20:30 - Permalink
I’ve just been hired by INRIA to develop a Mozilla-based, multimedia-dedicated, web authoring tool. I’m working in a team that has been very active in the SVG and SMIL working groups and that has developed Amaya a while ago. After three months working here, I came up with two conclusions:
- the full SMIL spec (≠ SVG animations) is completely overkill for web browsers
- the SMIL/Timing module is magic: simple to use and offers a lot of cool features to web pages like timing, media synchronization and user interaction management. I wish this could be part of HTML5!
I’m currently working on a JavaScript implementation of the SMIL/Timing module. I’ve had the opportunity to give a lightning talk about this project at the Mozilla Summit in Whistler, and I’ve made significant progress since.
Here’s a quick overview of SMIL/Timing and how we can use it in web pages. The full story and all the demos are on labs.kompozer.net/timesheets.
Timesheet Scheduler (Demo!)
I’ve started to implement the SMIL/Timing and SMIL/Timesheets specs in a JavaScript Timesheet Scheduler: with this small JS lib (less than 4KB for the minified/gzipped version), a lot of timing features and user interactions can be described without writing any specific JavaScript code. This can be easily used to design an slideshow like this one:
The full demo is available here: labs.kompozer.net/timesheets.
Instead of trying to implement the whole SMIL/Timing spec, I’ve focused on four basic use cases:
- Rotating Banner
- a simple example to demonstrate the basic concepts of time containers
- HTML Subtitles
-
synchronizing rich subtitles with a video stream
(requires <video> support) - Annotated Audio
-
synchronizing textual descriptions of musical sections
and introducing declarative user interaction
(requires <audio> and SVG support) - Slideshow Engine
- nesting time containers to create a highly flexible slideshow engine
Browser Requirements
This demo works with all modern browsers: Firefox 3.5+, Safari 5+, Chrome 5+, Opera 10.60+.
Firefox users: these demos work with Firefox 3.x but you’ll get a better experience with Firefox 4 (read: with CSS transition support).
Internet Explorer users: I’m afraid your browser isn’t supported yet — the IE9 support should come soon, though.
Timing Markup
Here’s an overview of the markup used in the first slideshow:
<div class="highlight" smil:timeContainer="excl" smil:first="restart.click">
<div id="slide1" smil:begin="0:00" smil:timeContainer="par">
<p> Ever wanted to… </p>
<ul smil:timeContainer="par">
<li smil:begin="0:02">
create your own slideshow in HTML?
</li>
<li smil:begin="0:04">
synchronize HTML content with multimedia streams?
<small>(subtitles, transcriptions, annotations…)</small>
</li>
<li smil:begin="0:06">
animate HTML elements?
</li>
</ul>
<h2 smil:begin="0:08">
…without writing any single line of JavaScript?
</h2>
</div>
<div id="slide2" smil:begin="0:12" smil:timeContainer="par">
[…]
</div>
<div id="slide3" smil:begin="0:24" smil:timeContainer="par">
<dl smil:timeContainer="par">
[…]
</dl>
<p smil:begin="0:04" class="menu">
<a href="about.xhtml">Learn more…</a>
<a href="#download">Download!</a>
<button id="restart">Restart</button>
</p>
</div>
</div>
The markup is rather self-explanatory and relies on two basic concepts
- time containers define the timing model of child nodes (<par>allel, <seq>uential or <excl>usive);
- the "begin" and "dur" attributes provide a basing timing description. Yes, this is the same syntax as the one used in SVG Animations.
That’s simple and efficient. The four examples on labs.kompozer.net/timesheets should be a step-by-step tutorial, and I have a few other demos in mind that I’ll add with the next release of our timesheet scheduler.
References: SMIL Timing and Timesheets
The SMIL/Timing
recommendation specifies two attributes, timeContainer and timeAction, to integrate timing and
synchronization features into HTML documents:
The modularization of SMIL 3.0 functionality allows language designers to integrate SMIL Timing and Synchronization support into any XML language. In addition to just scheduling media elements as in SMIL language documents, timing may be applied to the elements of the host language. For example, the addition of timing to HTML (i.e. XHTML) elements will control the presentation of the HTML document over time, and to synchronize text and presentation with continuous media such as audio and video.
Two attributes are introduced to support these integration cases. The timeContainer attribute allows the author to specify that any XML language element has time container behavior. E.g., an HTML
<ol>ordered list element may be defined to behave as a sequence time container. The timeAction attribute allows the author to specify what it means to apply timing to a given element.
The SMIL/Timesheets draft suggests another way to use SMIL/Timing (and SMIL/BasicAnimation) with HTML documents:
This language allows SMIL timing to be integrated into a wide variety of a-temporal languages, even when several such languages are combined in a compound document. Because of its similarity with external style and positioning descriptions in the Cascading Style Sheet (CSS) language, this functionality has been termed SMIL Timesheets.
SMIL Timesheets can be seen as a temporal counterpart of CSS. Whereas CSS defines the spatial layout of the document and formatting of the elements, SMIL Timesheets specify which elements are active at a certain moment and what their temporal scope is within a document. And as with CSS, SMIL Timesheets can be reused in multiple documents, which can provide a common temporal framework for multimedia presentations with different contents but identical storylines.
In other words, we’re not re-inventing the wheel or thinking of another slideshow engine: we’re just implementing an official W3C recommendation.
What's The Point?
Web Browsers Already Support SMIL
No they don't.
Modern web browsers (read: all except Internet Explorer) support declarative SVG Animations, which rely on the SMIL/BasicAnimation module — hence the (common) confusion — but can't be used for HTML timing. They don't support the whole SMIL recommendation.
Why Don't You Implement SMIL Instead?
The SMIL spec is huge, it includes a specific box-model which is very far from the HTML/CSS one, and it's only partially implemented by a few media players. It might be possible to implement SMIL in modern web browsers, too, but we think it would be inadequate:
- web authors would have to learn SMIL, which is much more difficult to use than HTML
- we don't want to include a SMIL section in a web page: we want to control the timing of the whole web page!
- HTML5 and CSS3 are already fine to describe the content and layout; all we need is a standard, declarative timing language.
SMIL has been designed for advanced synchronization tasks. Some SMIL aspects have already been ported to web standards (e.g. SVG animations and CSS transitions), our project is about porting SMIL/Timing and Timesheets to web documents.
I Can Already Do That With Flash/JavaScript
That's right. And you can still use JavaScript to get some rollover
effects if you don't want to use the CSS :hover
pseudo-class. ;-)
The point is precisely to use a declarative language for all the common tasks that currently require JavaScript development:
- that's much easier for web authors (and for web authoring tool developers);
- that's a much better way to achieve a good accessibility / indexability;
- that's easier to maintain, since no specific JavaScript code is used.
As this declarative language is (almost) standard, web browsers could implement it eventually. Until then, we'll provide a free, generic, JavaScript implementation.
IE Already Supports HTML+Time And Nobody Cares
True: Microsoft started supporting HTML+TIME 10 years ago with IE 5.5; but without SVG, <audio|video> elements and CSS transitions, there hasn't been many real-life use cases so far.
We think it's more than time to bring a modern, standard equivalent of HTML+Time to the web. Especially for multimedia-related tasks.
Roadmap
Bugfixing: before starting to work on the new editor, I have to get a stable Timesheet Scheduler first. In case you want to contribute: this JS lib is open-source (MIT license), code reviews and patches are welcome.
Event-values support: I’m not planning to implement the whole SMIL/Timing spec but at the very least, I need a better event-values support to describe more complex user interactions. Our goal is to get a full-featured web documentary engine.
Internet Explorer support: IE9 should be relatively easy to support (though CSS transitions will probably not work on this browser), but for older IE versions this is gonna be tricky as this SMIL/Timing implementation focuses on media synchronization, and requires <audio|video> support. A solution would be to use <object> fallbacks targetting the Windows Media Player plugin and design a JavaScript layer that would expose an HTML5-like API to control these object nodes (i.e. play/pause and the “timeupdate” event). If you heard about such a library, please ping me.
Timesheet Editor: the final goal of this project is to get an easy-to-use, multimedia page authoring tool. It will be based on Kompozer / SeaMonkey Composer, which will leave me some time to port Kompozer to Gecko 2 and backport most of its code to SeaMonkey. Yes, somehow I’ll get paid to work on Kompozer! *\o/*
Many thanks to Anthony Ricaud for his tips, and to Kompozer contributors for their early feedback.
Comments
amazing. Death to presentations and multimedia locked inside Flash widgets!
So your web authoring tool will generate HTML with one of the flavors of SMIL markup? It's great that you'll be advancing Kompozer.
Great job! This is really amazing stuff. HTML5 + JS are leading to some really impressive applications.
It would be nice to have a pause button somewhere, e.g. when the mouse hovers over the animation. A fast-forward button would also be good -- maybe something like the timeline widget you see in videos. That would also help the user to gauge how long the animation/presentation is.
Just my 2 cents :)
Also, I should point out that you are on the verge of replacing Keynote with a web browser -- and that is a truly great thing.
Marcus: you’re right. Speaking of the current work on the timesheet scheduler, there are two different aspects:
At the moment, my timesheet scheduler just adds a "time" property to the DOM node where the timeContainer attribute is defined, and this "time" object already exposes a "Pause()" method that I use regularly for debugging purposes (along with "getTime()" and "setTime()"). Adding a "setTimeMultiplier()" method would make sense too (especially when working on a slideshow), I’m adding this to my TODO-list. ;-)
My work on this JavaScript API has just begun and the API is still very much subject to change so it’s too early to talk about it yet, but I do want to enable more than “just declarative timing”. My plan is rather to support a basic declarative timing (and do it well) so it covers most of the common use cases, then allow some hackability with JavaScript: DOM-like time node navigation, generation of DOM3 events, custom event listeners that are automatically registered/stopped when a time container is activated/done… this kind of stuff.
Yes, that’s a key part of my secret world domination plan. :-)
Sincères félicitations pour avoir enfin trouvé un job te permettant de bosser sur un éditeur, sur mozilla. Tu en parlais depuis tellement longtemps que le champagne a j'espère coulé à flots ! Bravo !
Daniel: merci !
Il y a un certain Vincent Quint dans le bureau à coté du mien qui te transmet ses amitiés. ;-)
Et tu lui transmets en retour les miennes stp ; je te souhaite d'apprendre autant que j'ai pu apprendre d'Irène et lui !
Salut,
Ce serait bien si les sous-titres HTML/smil pouvaient être une option d'export d'un logiciel de gestion de sous-titres comme visualsubsync http://www.visualsubsync.org/. Vss permet la gestion des lignes (35 caractères par ligne, 2 lignes maximum) et pleins d'autres choses très pratiques quand on fait du sous-titre. Je me vois mal coder en dur des sous-titres au format HTML/smil.
Great project ! I enjoyed my time working in Vincent Quint's team on SMIL and other multimedia projects. I'm really exited to see some initiatives around authoring and Timesheets ! Best of luck, Dan :)
Hello,
Félicitations. C'est génial pour toi.
Et le projet est prometteur.
Est ce à dire que le développement de KompoZer a du plomb dans l'aile? ou peut-on espérer tout de même une évolution de KpZ? vers html5 et Css3 par exemple?
Quoi qu'il en soit, vraiment content pour toi!
Amitiés
Ça veut dire que Kompozer 0.9 est sur les rails, qu’il sera basé sur Gecko 2.0 (le moteur de Firefox 4) et qu’il supportera donc HTML5 et CSS3, qui sont rigoureusement indispensables au projet INRIA. J’ai déjà des protos en route, je tâcherai de mettre tout ça en ligne après le salon DocEng2010 — en clair, je vise une première alpha pour Octobre 2010.
La seule chose dont je ne sois pas encore sûr c’est de savoir si Kompozer 0.9 intègrera le support SMIL/Timing nativement ou via une extension. La question dépasse le seul projet INRIA, j’ai le choix entre deux options :
Pour l’instant je suis encore plongé dans l’implémentation SMIL/Timing, mais d’ici la fin du mois je devrais avoir une version suffisamment avancée pour prendre une décision pour la suite. La deuxième option suppose plus de boulot mais me permettrait de peaufiner une interface pour les diaporamas, ce qui répondrait à la fois aux besoins INRIA et à ceux des utilisateurs qui veulent une alternative à PowerPoint.
Merci de cette réponse claire et précise.
Je pense que tu pourras encore compter sur certains pour tester tout ça.
This is so great. I'm starting to build a slide show with audio narration building on the timesheet project, so I hope it will be further developed and maintained.
The next logical step would be to allow for multiple time code sources so that a page can have more than one audio or video tag as a synchronization source. This would result in more flexibility in building the HTM and allow to integrate a whole show with several video and audio elements in one HTML file.
Thank you very much for the work so far - and for the generous license.
Are the some news about the next Kompozer 0.8 Version? b4? Final? ???
Is there any reason the Kompozer icon appears as a gray-scale prohibitory design (circle with diagonal line) when it is not active, then the icon appears normal (colorful globe with leaf) when it is active? I use a new iMac. Thanks.
amazing. Death to presentations and multimedia locked inside Flash widgets!
So your web authoring tool will generate HTML with one of the flavors of SMIL markup? It's great that you'll be advancing Kompozer.
http://java.pakcarid.com/default.as...
KompoZer 0.8b3 is what I really want to get help on. I know this is in the wrong place, but unfortunately this is the only place I could find to put a comment. I don't use IRC, so from what I can see there is no other place available for user help.
Neat product. I love it and have for some time. I've happily used it on Linux, Vista, and XP.
This new version is giving me enough trouble with simply opening a site that I'm ready to give it up, and there's no place to get help.
It speaks well for the product that I've only now run into a problem that makes it genuinely unusable for me, I will say that.
This is a superb post Kaz'hack .
But I was wondering how do I suscribe to the RSS feed?
This is a superb post Kaz'hack .
But I was wondering how do I suscribe to the RSS feed?