Skip to content

Commit

Permalink
Change seek positions for dynamic source
Browse files Browse the repository at this point in the history
  • Loading branch information
pawel-bartkowiak-epam committed Jun 30, 2023
1 parent 2bebd1c commit 01ee8c8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/mediaTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function waitForEvent(video, runner, event, predicate = null, maxWaitTimeMs = 10

function eventHandler() {
if (harnessConfig.debug) {
runner.log("current time: " + video.currentTime)
runner.log("current time: " + video.currentTime);
}
if (!predicate || predicate(video)) {
receivedEvents += 1;
Expand Down Expand Up @@ -224,16 +224,18 @@ var testSetPosition = new TestTemplate("Seek", function (video, runner) {
const hasVideoTrack = this.content.video;
var positions = [0, 20, 45];
if (this.content.dynamic) {
positions = [video.currentTime - 10, video.currentTime + 10, video.currentTime];
let curTime = video.currentTime;
positions = [curTime - 40, curTime - 20, curTime];
}

const makeSeekTest = function (position) {
return () => {
return new Promise((resolve, _) => {
runner.log("Changing position to " + position);
seek(video, runner, position).then(() => {
runner.checkGE(video.currentTime, position, "currentTime should be greater or equal to seek point");
runner.checkGr(position + 10, video.currentTime, "currentTime should be less than seek point + 10s");
let curTime = video.currentTime;
runner.checkGE(curTime, position, "currentTime should be greater or equal to seek point");
runner.checkGr(position + 10, curTime, "currentTime should be less than seek point + 10s");
checkVideoFramesIncreasing(video, runner, hasVideoTrack).then(resolve);
});
});
Expand Down

0 comments on commit 01ee8c8

Please sign in to comment.