javascript - Dynamically append and remove mpeg-dash segments from mediasource sourcebuffer -
i writing simple mpeg-dash streaming player using html5 video element. creating mediasource
, attaching sourcebuffer
it. appending dash fragments sourcebuffer , working fine.
now, want is, want pre-fetch segments dynamically depending upon current time of media element. while doing there lot of doubts , not answered mediasource document.
is possible know how data sourcebuffer can support @ time? if have large video , append fragments sourcebuffer, accommodate fragments or cause errors or slow down browser?
how compute number of fragments in sourcebuffer?
how compute presentation time or end time of last segment in
sourcebuffer
?how remove specific set of fragments
sourcebuffer
, replace them segments other resolutions? (i want support adaptive resolution switching run time.)
thanks.
the maximum amount of buffered data implementation detail , not exposed developer in way afaik. according spec, when appending new data browser execute coded frame eviction algorithm removes buffered data deemed unnecessary browser. browsers tend remove part of stream has been played , don't remove parts of stream in future relative current time. means if stream large , dash player downloads quickly, faster mse can play it, there lot of stream cannot remove coded frame eviction algorithm , may cause append buffer method throw quotaexceedederror. of course dash player should monitor buffered amount , not download excessive amounts of data.
in plain text: have nothing worry about, unless player downloads of stream possible without taking under consideration current buffered amount.
the mse api works stream of data (audio or video). has no knowledge of segments. theoretically buffered timerange , map to pair of segments using timing data provided in mpd. fragile imho. better keep track of downloaded , fed segments.
look @ buffered property. easiest way end time in seconds of last appended segments simply:
videoelement.buffered.end(0)
if
presentation time
meanpresentation timestamp
of last buffered frame there no way of doing apart parsing stream itself.to remove buffered data can use remove method.
quality switching
quite easy although spec doesn't it. switch qualities thing have append init header new qualitysourcebuffer
. after can append segments new quality usual.
i find youtube dash mse test player place learn.
Comments
Post a Comment