av-merge: Make segment fetching message more useful
Signed-off-by: Jesús <heckyel@hyperbola.info>
This commit is contained in:
parent
1c591b4457
commit
ae68c84a26
@ -197,6 +197,8 @@ Stream.prototype.appendSegment = function(segmentIdx, chunk) {
|
|||||||
if (this.closed)
|
if (this.closed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
this.reportDebug('Received segment', segmentIdx)
|
||||||
|
|
||||||
// cannot append right now, schedule for updateend
|
// cannot append right now, schedule for updateend
|
||||||
if (this.sourceBuffer.updating) {
|
if (this.sourceBuffer.updating) {
|
||||||
this.reportDebug('sourceBuffer updating, queueing for later');
|
this.reportDebug('sourceBuffer updating, queueing for later');
|
||||||
@ -308,6 +310,11 @@ Stream.prototype.segmentInBuffer = function(segmentIdx) {
|
|||||||
Stream.prototype.fetchSegment = function(segmentIdx) {
|
Stream.prototype.fetchSegment = function(segmentIdx) {
|
||||||
entry = this.sidx.entries[segmentIdx];
|
entry = this.sidx.entries[segmentIdx];
|
||||||
entry.requested = true;
|
entry.requested = true;
|
||||||
|
this.reportDebug(
|
||||||
|
'Fetching segment', segmentIdx, ', bytes',
|
||||||
|
entry.start, entry.end, ', seconds',
|
||||||
|
entry.tickStart/this.sidx.timeScale, entry.tickEnd/this.sidx.timeScale
|
||||||
|
)
|
||||||
fetchRange(
|
fetchRange(
|
||||||
this.url,
|
this.url,
|
||||||
entry.start,
|
entry.start,
|
||||||
@ -350,14 +357,12 @@ Stream.prototype.reportError = function(...args) {
|
|||||||
// Utility functions
|
// Utility functions
|
||||||
|
|
||||||
function fetchRange(url, start, end, cb) {
|
function fetchRange(url, start, end, cb) {
|
||||||
reportDebug('fetchRange', start, end);
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open('get', url);
|
xhr.open('get', url);
|
||||||
xhr.responseType = 'arraybuffer';
|
xhr.responseType = 'arraybuffer';
|
||||||
xhr.setRequestHeader('Range', 'bytes=' + start + '-' + end);
|
xhr.setRequestHeader('Range', 'bytes=' + start + '-' + end);
|
||||||
xhr.onload = function() {
|
xhr.onload = function() {
|
||||||
reportDebug('fetched bytes: ', start, end);
|
|
||||||
//bytesFetched += end - start + 1;
|
//bytesFetched += end - start + 1;
|
||||||
resolve(cb(xhr.response));
|
resolve(cb(xhr.response));
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user