W3C home > Mailing lists > Public > www-smil@w3.org > April to June 2003

Re: SMIL and Javascript

From: J.R. van Ossenbruggen <Jacco.van.Ossenbruggen@cwi.nl>
Date: Thu, 10 Apr 2003 14:15:09 +0200
To: Ryan Henderson <rhendo@wasp.net.au>
Cc: www-smil@w3.org
Message-Id: <20030410121509.980CF8056D@gemini.ins.cwi.nl>

On Fri, Apr 4 2003 Ryan Henderson wrote:
> 
> Hi all,
> 
> Not so sure this is the correct list to post to 

I think you've found the right list.

> but anyway here goes.
> 
> I have been developing a product that synchonises media with a Quick Time
> movie (currently it uses QT chapter tracks and Href tracks). The media can
> include Text, Images, other Movies, and Web Sites. Now pretty much all of
> the media here can be displayed using SMIL. However to integrate SMIL into
> our existing product easier we would like to use pre developed java script
> calls.

My personal opinion is that SMIL was not designed with scripting high
on the agenda...

> So in a nutshell my question is: At predetermined times within a SMIL
> presentation can java script calls be made? For example we have a call to
> display a web site in a new window, this may be made at say 2minutes and 31
> seconds in to the movie...

I think you have two problems here.  
1) Does your SMIL player support javascript?
   I do not know any that does, but if you've developed your own SMIL player,
   the second question is:
2) How do you encode it in SMIL?

   If you want to stick to the SMIL REC, the only way I can think of
   is using the <ref> element with the appropriate MIME type
   attribute, and than using a data: URI scheme:

      <ref type="application/javascript" 
           src="data:jscript.function.call()"/>

   Note that in the example above, I "forgot" to escape the string
   after "data:", but after proper escaping, elegance is not the first
   word that comes to mind...

   You could also implement a SMIL extension using your own namespace:

   <myext:script xmlns:myext="http://www.mycompany.com/smil/script/extension">
     jscript.function.call()
   </myext:script>

I hope this helps,

-- Jacco
Received on Thursday, 10 April 2003 08:15:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:53:28 GMT