This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The current spec text makes no mention of how the duration attribute on the HTMLMediaElement is set. The current Chromium implementation just fetches this value from the first initialization segment and uses that. This is ok if all the initialization segments happen to have the same duration. In the ad-insertion use case though an initialization segment with a significantly different duration may get appended and the web application may want the inserted content to actually increase the duration of the presentation. Rules about how duration is set and updated need to be defined.
A possible solution to consider: Make duration attribute writable and don't allow a transition to HAVE_METADATA until it is set by the web application or the first initialization segment is appended with a duration. From that point on the duration can only be modified by the web application and future initialization segments won't effect the duration. If the duration becomes shorter than the previous value, all data in the source buffer beyond the duration will be flushed. If the playback position is beyond the new duration, the HTMLMediaElement will act as if it just reached the end of the presentation and fire all appropriate events. If we feel it's necessary to allow the duration to be updatable by a future initialization segment, then we could simply have the web application set the duration to NaN. (I'm not thrilled about this, but interested in comments.)
Spec changes committed. Revision: http://dvcs.w3.org/hg/html-media/rev/087ea42f59c8 Mailing list discussion: http://lists.w3.org/Archives/Public/public-html-media/2012Jul/0050.html