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.

  1. 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?

  2. how compute number of fragments in sourcebuffer?

  3. how compute presentation time or end time of last segment in sourcebuffer?

  4. how remove specific set of fragments sourcebuffer , replace them segments other resolutions? (i want support adaptive resolution switching run time.)

thanks.

  1. 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.

  2. 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.

  3. look @ buffered property. easiest way end time in seconds of last appended segments simply: videoelement.buffered.end(0)

    if presentation time mean presentation timestamp of last buffered frame there no way of doing apart parsing stream itself.

  4. 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 quality sourcebuffer. after can append segments new quality usual.

i find youtube dash mse test player place learn.


Comments

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -