Skip to content

Commit

Permalink
feat: make low latency over gaps test detect automatic skip (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
FritzHeiden authored May 6, 2024
1 parent 86359e7 commit f7b7990
Show file tree
Hide file tree
Showing 7 changed files with 203 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,39 @@
});
}, "video ended event fired");

function onPlayerWaiting() {
var playbackMode = parameters.playbackMode;
var gapDuration = parameters.gapDuration;
var waitingDuration = 0;
if (playbackMode === dpctfTest.PLAYBACK_MODE_LIVE) {
waitingDuration = gapDuration;
dpctfTest.asyncTest(function (test) {
function onPlayerWaiting() {
var playbackMode = parameters.playbackMode;
var gapDuration = parameters.gapDuration;
var waitingDuration = 0;
if (playbackMode === dpctfTest.PLAYBACK_MODE_LIVE) {
waitingDuration = gapDuration;
}
video.addEventListener("playing", onPlayerPlaying);
setTimeout(function () {
video.removeEventListener("waiting", onPlayerWaiting);
player.setCurrentTime(video.buffered.start(1));
test.step(function () {
assert_true(true);
});
done();
test.done();
}, waitingDuration);
}
setTimeout(function () {

function onPlayerPlaying() {
video.removeEventListener("waiting", onPlayerWaiting);
player.setCurrentTime(video.buffered.start(1));
test.step(function () {
assert_true(false);
});
test.done();
done();
}, waitingDuration);
}
}

player
.playOnBufferLoaded(minBufferDuration)
.then(video.addEventListener("waiting", onPlayerWaiting));
player.playOnBufferLoaded(minBufferDuration).then(function () {
video.addEventListener("waiting", onPlayerWaiting);
});
}, "video remains in waiting state until skipping over the gap");
}
</script>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,39 @@
});
}, "video ended event fired");

function onPlayerWaiting() {
var playbackMode = parameters.playbackMode;
var gapDuration = parameters.gapDuration;
var waitingDuration = 0;
if (playbackMode === dpctfTest.PLAYBACK_MODE_LIVE) {
waitingDuration = gapDuration;
dpctfTest.asyncTest(function (test) {
function onPlayerWaiting() {
var playbackMode = parameters.playbackMode;
var gapDuration = parameters.gapDuration;
var waitingDuration = 0;
if (playbackMode === dpctfTest.PLAYBACK_MODE_LIVE) {
waitingDuration = gapDuration;
}
video.addEventListener("playing", onPlayerPlaying);
setTimeout(function () {
video.removeEventListener("waiting", onPlayerWaiting);
player.setCurrentTime(video.buffered.start(1));
test.step(function () {
assert_true(true);
});
done();
test.done();
}, waitingDuration);
}
setTimeout(function () {

function onPlayerPlaying() {
video.removeEventListener("waiting", onPlayerWaiting);
player.setCurrentTime(video.buffered.start(1));
test.step(function () {
assert_true(false);
});
test.done();
done();
}, waitingDuration);
}
}

player
.playOnBufferLoaded(minBufferDuration)
.then(video.addEventListener("waiting", onPlayerWaiting));
player.playOnBufferLoaded(minBufferDuration).then(function () {
video.addEventListener("waiting", onPlayerWaiting);
});
}, "video remains in waiting state until skipping over the gap");
}
</script>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,39 @@
});
}, "video ended event fired");

function onPlayerWaiting() {
var playbackMode = parameters.playbackMode;
var gapDuration = parameters.gapDuration;
var waitingDuration = 0;
if (playbackMode === dpctfTest.PLAYBACK_MODE_LIVE) {
waitingDuration = gapDuration;
dpctfTest.asyncTest(function (test) {
function onPlayerWaiting() {
var playbackMode = parameters.playbackMode;
var gapDuration = parameters.gapDuration;
var waitingDuration = 0;
if (playbackMode === dpctfTest.PLAYBACK_MODE_LIVE) {
waitingDuration = gapDuration;
}
video.addEventListener("playing", onPlayerPlaying);
setTimeout(function () {
video.removeEventListener("waiting", onPlayerWaiting);
player.setCurrentTime(video.buffered.start(1));
test.step(function () {
assert_true(true);
});
done();
test.done();
}, waitingDuration);
}
setTimeout(function () {

function onPlayerPlaying() {
video.removeEventListener("waiting", onPlayerWaiting);
player.setCurrentTime(video.buffered.start(1));
test.step(function () {
assert_true(false);
});
test.done();
done();
}, waitingDuration);
}
}

player
.playOnBufferLoaded(minBufferDuration)
.then(video.addEventListener("waiting", onPlayerWaiting));
player.playOnBufferLoaded(minBufferDuration).then(function () {
video.addEventListener("waiting", onPlayerWaiting);
});
}, "video remains in waiting state until skipping over the gap");
}
</script>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,39 @@
});
}, "video ended event fired");

function onPlayerWaiting() {
var playbackMode = parameters.playbackMode;
var gapDuration = parameters.gapDuration;
var waitingDuration = 0;
if (playbackMode === dpctfTest.PLAYBACK_MODE_LIVE) {
waitingDuration = gapDuration;
dpctfTest.asyncTest(function (test) {
function onPlayerWaiting() {
var playbackMode = parameters.playbackMode;
var gapDuration = parameters.gapDuration;
var waitingDuration = 0;
if (playbackMode === dpctfTest.PLAYBACK_MODE_LIVE) {
waitingDuration = gapDuration;
}
video.addEventListener("playing", onPlayerPlaying);
setTimeout(function () {
video.removeEventListener("waiting", onPlayerWaiting);
player.setCurrentTime(video.buffered.start(1));
test.step(function () {
assert_true(true);
});
done();
test.done();
}, waitingDuration);
}
setTimeout(function () {

function onPlayerPlaying() {
video.removeEventListener("waiting", onPlayerWaiting);
player.setCurrentTime(video.buffered.start(1));
test.step(function () {
assert_true(false);
});
test.done();
done();
}, waitingDuration);
}
}

player
.playOnBufferLoaded(minBufferDuration)
.then(video.addEventListener("waiting", onPlayerWaiting));
player.playOnBufferLoaded(minBufferDuration).then(function () {
video.addEventListener("waiting", onPlayerWaiting);
});
}, "video remains in waiting state until skipping over the gap");
}
</script>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,39 @@
});
}, "video ended event fired");

function onPlayerWaiting() {
var playbackMode = parameters.playbackMode;
var gapDuration = parameters.gapDuration;
var waitingDuration = 0;
if (playbackMode === dpctfTest.PLAYBACK_MODE_LIVE) {
waitingDuration = gapDuration;
dpctfTest.asyncTest(function (test) {
function onPlayerWaiting() {
var playbackMode = parameters.playbackMode;
var gapDuration = parameters.gapDuration;
var waitingDuration = 0;
if (playbackMode === dpctfTest.PLAYBACK_MODE_LIVE) {
waitingDuration = gapDuration;
}
video.addEventListener("playing", onPlayerPlaying);
setTimeout(function () {
video.removeEventListener("waiting", onPlayerWaiting);
player.setCurrentTime(video.buffered.start(1));
test.step(function () {
assert_true(true);
});
done();
test.done();
}, waitingDuration);
}
setTimeout(function () {

function onPlayerPlaying() {
video.removeEventListener("waiting", onPlayerWaiting);
player.setCurrentTime(video.buffered.start(1));
test.step(function () {
assert_true(false);
});
test.done();
done();
}, waitingDuration);
}
}

player
.playOnBufferLoaded(minBufferDuration)
.then(video.addEventListener("waiting", onPlayerWaiting));
player.playOnBufferLoaded(minBufferDuration).then(function () {
video.addEventListener("waiting", onPlayerWaiting);
});
}, "video remains in waiting state until skipping over the gap");
}
</script>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,39 @@
});
}, "video ended event fired");

function onPlayerWaiting() {
var playbackMode = parameters.playbackMode;
var gapDuration = parameters.gapDuration;
var waitingDuration = 0;
if (playbackMode === dpctfTest.PLAYBACK_MODE_LIVE) {
waitingDuration = gapDuration;
dpctfTest.asyncTest(function (test) {
function onPlayerWaiting() {
var playbackMode = parameters.playbackMode;
var gapDuration = parameters.gapDuration;
var waitingDuration = 0;
if (playbackMode === dpctfTest.PLAYBACK_MODE_LIVE) {
waitingDuration = gapDuration;
}
video.addEventListener("playing", onPlayerPlaying);
setTimeout(function () {
video.removeEventListener("waiting", onPlayerWaiting);
player.setCurrentTime(video.buffered.start(1));
test.step(function () {
assert_true(true);
});
done();
test.done();
}, waitingDuration);
}
setTimeout(function () {

function onPlayerPlaying() {
video.removeEventListener("waiting", onPlayerWaiting);
player.setCurrentTime(video.buffered.start(1));
test.step(function () {
assert_true(false);
});
test.done();
done();
}, waitingDuration);
}
}

player
.playOnBufferLoaded(minBufferDuration)
.then(video.addEventListener("waiting", onPlayerWaiting));
player.playOnBufferLoaded(minBufferDuration).then(function () {
video.addEventListener("waiting", onPlayerWaiting);
});
}, "video remains in waiting state until skipping over the gap");
}
</script>
</body>
Expand Down
42 changes: 29 additions & 13 deletions low-latency-playback-over-gaps.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,39 @@
});
}, "video ended event fired");

function onPlayerWaiting() {
var playbackMode = parameters.playbackMode;
var gapDuration = parameters.gapDuration;
var waitingDuration = 0;
if (playbackMode === dpctfTest.PLAYBACK_MODE_LIVE) {
waitingDuration = gapDuration;
dpctfTest.asyncTest(function (test) {
function onPlayerWaiting() {
var playbackMode = parameters.playbackMode;
var gapDuration = parameters.gapDuration;
var waitingDuration = 0;
if (playbackMode === dpctfTest.PLAYBACK_MODE_LIVE) {
waitingDuration = gapDuration;
}
video.addEventListener("playing", onPlayerPlaying);
setTimeout(function () {
video.removeEventListener("waiting", onPlayerWaiting);
player.setCurrentTime(video.buffered.start(1));
test.step(function () {
assert_true(true);
});
done();
test.done();
}, waitingDuration);
}
setTimeout(function () {

function onPlayerPlaying() {
video.removeEventListener("waiting", onPlayerWaiting);
player.setCurrentTime(video.buffered.start(1));
test.step(function () {
assert_true(false);
});
test.done();
done();
}, waitingDuration);
}
}

player
.playOnBufferLoaded(minBufferDuration)
.then(video.addEventListener("waiting", onPlayerWaiting));
player.playOnBufferLoaded(minBufferDuration).then(function () {
video.addEventListener("waiting", onPlayerWaiting);
});
}, "video remains in waiting state until skipping over the gap");
}
</script>
</body>
Expand Down

0 comments on commit f7b7990

Please sign in to comment.