Re: processing click events when restart="whenNotActive"

Hi Dana,

I can try to explane this, however I might be wrong..

On Sun, 26 Jan 2003 21:16:51 +0200 Dana Rosenfeld <Dana.rosenfeld@emblaze.com> 
wrote:

> Consider this SMIL source:
>  
> <smil xmlns=" http://www.w3.org/2001/SMIL20/Language">
>   <head>
>     <layout>
>       <root-layout id="viewport-0" title="viewport 0" 
> backgroundColor="black" width="400" height="400"/>
>       <region id="r1" left="0" width="400" top="0" height="100"/>
>       <region id="r2" left="0" width="400" top="100" height="200"/>
>       <region id="r3" left="0" width="400" top="300" height="100"/>
>     </layout>
>   </head>
>   <body>
>     <par dur="30s">
>       <img id="bar" region="r1" dur="30s" src="../images/frown.jpg"/>
>       <img id="foo" region="r2" 
> begin="0;bar.activateEvent+10;joe.activateEvent" dur="8s"
> end="bar.activateEvent+11" restart="whenNotActive"
> src="../images/smile.jpg"/>
>       <img id="joe" region="r3" dur="30s" src="../images/frown.jpg"/>
>     </par>
>   </body>
> </smil>
> 
> Now, lets say that the user clicks on bar at t=2s and then clicks on
> joe at t=9s.
> How is the player supposed to react?
>  
> Since activating bar can either begin or end foo - we should check
> foo's state on t+10.
> At first (before the user clicks on joe), it seems that we should
> consider the first click as a begin trigger.
> But then comes the second click, and so the logical approach is to
> change the first click to be considered as an end trigger.

I think that when the user clicks on bar, it will be considered as an end 
event, because foo is already active [interval 0-8s]. See 
http://www.w3.org/TR/smil20/smil-timing.html#Timing-EventSensitivity

"3. If an element is (already) active when an event is raised, ...: if 
restart="whenNotActive", then any begin specification of the event is ignored 
for this instance of the event. If end specifies the event, an end value is 
resolved based upon the event time"

So, in the example you gave, foo will be played 0-8s and after that 9-13s 
(begins because of joe 9s and ends because bar was clicked: 2s+11s=13s). 
I know this all seems quite strange, but I think this is the way it works..

> BUT, it doesn't make any sense! Do I have to keep a list of all
> "doubled" events, in case that the user behaves like that? It seems to
> me very clumsy. Can't I just consider the first click as a begin
> trigger and when the second click comes (t=9s) - restart foo and and
> end it after 8s? (since I won't be able to restart foo again)

Just make the decision about the begin / end event triggering when you get the 
event, add the time offset and insert the time to the time instance list. Based 
on the usual SMIL interval calculation you then create the time intervals.

 regards, 
      Kari

Received on Wednesday, 29 January 2003 03:39:56 UTC