[web-anim] automatically discarding animations

My intuition says that it should maybe be impossible to seek back and 
forward in time TimedItems unless it's explicitely stated on creation that 
it should be possible. This would allow an highly optimizable behavior by 
default. The memory-costly behavior giving the possibility to go backward 
and forward in time should be an opt-in. Developers choosing for the opt-in 
would be responsible of the memory management issues.

BTW, I would remove the "timeStart" property. It's much easier to say that 
the document's time source is automatically started on load, except

    - if its "autoplay" property is set to false before the page load
    - if its "play" method is called before the page load (on document 
ready...)



If we provide both seekable and unseekable time sources to developers, I've 
the feeling we should continue to import attributes from the 
HTMLMediaElement interface. Interesting attributes includes:

    - seekable : TimeRanges
        The time ranges that the user is able to seek to, if any. Read only.

    - seeking : Boolean
        Indicates whether the time source is in the process of seeking to a 
new position. Read only.

    - autoplay : Boolean
        Indicates whether to start the time source as soon as it's ready. 
Defaults to true.




As far as I can envision, I can see up to four different time sources being 
supported :

    - RigidTimeSource implements TimeSource
        initialTime
            = 0 // once started with play() method

        duration
            = NaN // no limit

        seekable
            = TimeRanges[] // not seekable

        autoplay
            = true // auto-start by default

        - animations going from active to
            inactive are automatically discared

        - we can get a global instance from
            the document.timeSource property


    - FluidTimeSouce implements TimeSource
        initialTime
            = 0 // once started with play() method

        duration
            = NaN // can be modified

        seekable
            = TimeRanges[<NegativeInfinity, PositiveInfinity>] // yes, 
anywhere; memory pressure can force to reduce the interval

        autoplay
            = true // auto-start by default

        - animations going from active to inactive can
            be discarded in case of memory pressure.

        - the use of the seekable attribute allows to
            know which time ranges are still supported
            for seek operations.

        - it's probably possible to allow authors to
            specify a preferred seekDuration.


    - TimedItem implements TimeSource

        - see current specification.

        - performs calculations based on
            parent time source and timeDrift.

        - used as time source for child items;
            timeDrift allows to have the parent
            time source to move on while keeping
            children timed items at the same time
            (paused).


    - HTMLMediaElement (implements TimeSource)

        - see the HTML specification for the
            attributes default value and behavior.



What do you think of this model?
François 

Received on Friday, 3 August 2012 12:51:02 UTC