Re: SMIL and Javascript

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 UTC