UNPKG

@videojs/http-streaming

Version:

Play back HLS and DASH with Video.js, even where it's not natively supported

24 lines (20 loc) 533 B
/** * Combine all segments into a single Uint8Array * * @param {Object} segmentObj * @return {Uint8Array} concatenated bytes * @private */ export const concatSegments = (segmentObj) => { let offset = 0; let tempBuffer; if (segmentObj.bytes) { tempBuffer = new Uint8Array(segmentObj.bytes); // combine the individual segments into one large typed-array segmentObj.segments.forEach((segment) => { tempBuffer.set(segment, offset); offset += segment.byteLength; }); } return tempBuffer; };