aboutsummaryrefslogtreecommitdiffstats
path: root/youtube
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2021-08-27 19:18:18 -0700
committerJesús <heckyel@hyperbola.info>2021-08-29 21:54:32 -0500
commitae68c84a26055e1fea481e26063ed99cf832ede9 (patch)
tree131ef6de775f8461dfcccae4d9ed30904e60c202 /youtube
parent1c591b445738a3bb217d59424adcb4e9ea5b596e (diff)
downloadyt-local-ae68c84a26055e1fea481e26063ed99cf832ede9.tar.lz
yt-local-ae68c84a26055e1fea481e26063ed99cf832ede9.tar.xz
yt-local-ae68c84a26055e1fea481e26063ed99cf832ede9.zip
av-merge: Make segment fetching message more useful
Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'youtube')
-rw-r--r--youtube/static/js/av-merge.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/youtube/static/js/av-merge.js b/youtube/static/js/av-merge.js
index cf1210a..583ce1f 100644
--- a/youtube/static/js/av-merge.js
+++ b/youtube/static/js/av-merge.js
@@ -197,6 +197,8 @@ Stream.prototype.appendSegment = function(segmentIdx, chunk) {
if (this.closed)
return;
+ this.reportDebug('Received segment', segmentIdx)
+
// cannot append right now, schedule for updateend
if (this.sourceBuffer.updating) {
this.reportDebug('sourceBuffer updating, queueing for later');
@@ -308,6 +310,11 @@ Stream.prototype.segmentInBuffer = function(segmentIdx) {
Stream.prototype.fetchSegment = function(segmentIdx) {
entry = this.sidx.entries[segmentIdx];
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(
this.url,
entry.start,
@@ -350,14 +357,12 @@ Stream.prototype.reportError = function(...args) {
// Utility functions
function fetchRange(url, start, end, cb) {
- reportDebug('fetchRange', start, end);
return new Promise((resolve, reject) => {
var xhr = new XMLHttpRequest();
xhr.open('get', url);
xhr.responseType = 'arraybuffer';
xhr.setRequestHeader('Range', 'bytes=' + start + '-' + end);
xhr.onload = function() {
- reportDebug('fetched bytes: ', start, end);
//bytesFetched += end - start + 1;
resolve(cb(xhr.response));
};