A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/apis/media_source_extensions/MediaSource/appendBuffer below:

appendBuffer ยท WebPlatform Docs

appendBuffer Summary

Appends the specified media segment to the SourceBuffer.

Method of apis/media_source_extensions/MediaSourceapis/media_source_extensions/MediaSource

Syntax
 SourceBuffer.appendBuffer(data);
Parameters data
Data-type
VARIANT

Type: ArrayBuffer. The media segment to append

Return Value

No return value

Examples

This example uses XMLHttpRequest to get a segment of video (range) from a file (url) and appends it to the current sourceBuffer.




function initVideo(range, url) {
  var xhr = new XMLHttpRequest();
  if (range || url) { 
    
    xhr.open('GET', url);
    xhr.setRequestHeader("Range", "bytes=" + range);
    segCheck = (timeToDownload(range) * .8).toFixed(3); 
    xhr.send();
    xhr.responseType = 'arraybuffer';
    try {   xhr.addEventListener("readystatechange", function () {
         if (xhr.readyState == xhr.DONE) { 
          
          try {            videoSource.appendBuffer(new Uint8Array(xhr.response));
            
          } catch (e) {
            log('Exception while appending initialization content', e);
          }
        }
      }, false);
    } catch (e) {
      log(e);
    }
  } else {
    return 
  }
}
function updateFunct() {
  
  
  bufferUpdated = true;
  getStarted(file); 
  
videoSource.removeEventListener("update", updateFunct);
}
Related specifications
Media Source Extensions
W3C Candidate Recommendation
See also Related articles Multimedia Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4