SVG and getCurrentTime

Hi all,

During our previous F2F, I presented a JS SVG player behaving like a 
video player [1]. I mentionned that I had a problem with the way 
getCurrentTime() on the root SVG element was behaving, namely that calls 
to getCurrentTime() in Chrome would return different values over time 
when pauseAnimations() had been called. It was mentioned that it was 
probably a bug in Chrome and that it should work in Firefox. I've tested 
it [2] and indeed it works in FF. I wanted to file a bug on Chrome but 
found out that the spec is not really crystal clear on this.

The spec says:
"float getCurrentTime()
Returns the current time in seconds relative to the start time for the 
current SVG document fragment. If getCurrentTime is called before the 
document timeline has begun (for example, by script running in a 
‘script’ element before the document's SVGLoad event is dispatched), 
then 0 is returned.
Returns
The current time in seconds, or 0 if the document timeline has not yet 
begun. "

Note that this does not mention from which clock the time comes from.

setCurrentTime says:
"Adjusts the clock for this SVG document fragment"
Note the *the* clock, which seems to mean that there is only one clock 
for the document fragment.

getCurrentTime on animation elements says:
"float getCurrentTime()
Returns the current time in seconds relative to time zero for the given 
time container. "
Here the notion of time container is introduced.

In another place in the SVG spec, we find:
"In the case of SVG, since the parent time container is the SVG document 
fragment, then the animation cannot be restarted for the remainder of 
the document duration."

I think we all know and agree that there is only one time container in 
SVG 1.1 and that the clock of this container is the one used to get the 
currentTime from on the root element and on animation elements. But I 
couldn't find where this was clearly written. I think this should be 
clarified. This will probably be clarified with Web Animations too, but 
I don't know enough about it. Will the multiple time containers be 
locked/independent from each other? Will there be an API to pause the 
document time and all animations in the document?

Regards,
Cyril

[1] 
http://concolato.wp.mines-telecom.fr/2013/05/31/playing-svg-content-in-html5-video-elements/
[2] 
http://perso.telecom-paristech.fr/~concolat/html5_tests/svg-getCurrentTime.html

-- 
Cyril Concolato
Maître de Conférences/Associate Professor
Groupe Multimedia/Multimedia Group
Telecom ParisTech
46 rue Barrault
75 013 Paris, France
http://concolato.wp.mines-telecom.fr/

Received on Tuesday, 25 June 2013 19:40:49 UTC