Skip to content

Commit

Permalink
Rename timeAsUTC method
Browse files Browse the repository at this point in the history
  • Loading branch information
dsilhavy committed Dec 11, 2024
1 parent b53b6ef commit b1fe6d6
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions contrib/akamai/controlbar/ControlBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ var ControlBar = function (dashjsMediaPlayer, displayUTCTimeCodes) {
};

var _onPlayStart = function (/*e*/) {
setTime(displayUTCTimeCodes ? self.player.timeAsUtc() : self.player.timeInDvrWindow());
setTime(displayUTCTimeCodes ? self.player.timeAsUTC() : self.player.timeInDvrWindow());
updateDuration();
togglePlayPauseBtnState();
if (seekbarBufferInterval) {
Expand All @@ -193,7 +193,7 @@ var ControlBar = function (dashjsMediaPlayer, displayUTCTimeCodes) {
var _onPlayTimeUpdate = function (/*e*/) {
updateDuration();
if (!seeking) {
setTime(displayUTCTimeCodes ? player.timeAsUtc() : player.timeInDvrWindow());
setTime(displayUTCTimeCodes ? player.timeAsUTC() : player.timeInDvrWindow());
if (seekbarPlay) {
seekbarPlay.style.width = Math.max((player.timeInDvrWindow() / player.duration() * 100), 0) + '%';
}
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ declare namespace dashjs {

duration(): number;

timeAsUtc(): number;
timeAsUTC(): number;

getActiveStream(): Stream | null;

Expand Down
2 changes: 1 addition & 1 deletion samples/live-streaming/availability-time-offset.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
document.querySelector('#sec').innerHTML = (seconds < 10 ? '0' : '') + seconds;
var minutes = d.getMinutes();
document.querySelector('#min').innerHTML = (minutes < 10 ? '0' : '') + minutes + ':';
document.querySelector('#videoDelay').innerHTML = Math.round((d.getTime() / 1000) - Number(player.timeAsUtc()));
document.querySelector('#videoDelay').innerHTML = Math.round((d.getTime() / 1000) - Number(player.timeAsUTC()));
document.querySelector('#videoBuffer').innerHTML = player.getBufferLength() + 's';
}
}, 1000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
document.querySelector('#sec').innerHTML = (seconds < 10 ? '0' : '') + seconds;
var minutes = d.getMinutes();
document.querySelector('#min').innerHTML = (minutes < 10 ? '0' : '') + minutes + ':';
document.querySelector('#videoDelay').innerHTML = Math.round((d.getTime() / 1000) - Number(player.timeAsUtc()));
document.querySelector('#videoDelay').innerHTML = Math.round((d.getTime() / 1000) - Number(player.timeAsUTC()));
document.querySelector('#videoBuffer').innerHTML = player.getBufferLength() + 's';
}
}, 1000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
document.querySelector('#min').innerHTML = (minutes < 10 ? '0' : '') + minutes + ':';
for (var i = 1; i < 7; i++) {
var p = eval('player' + i);
document.querySelector('#video' + i + 'delay').innerHTML = Math.round((d.getTime() / 1000) - Number(p.timeAsUtc()));
document.querySelector('#video' + i + 'delay').innerHTML = Math.round((d.getTime() / 1000) - Number(p.timeAsUTC()));
document.querySelector('#video' + i + 'buffer').innerHTML = p.getBufferLength() + 's';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
document.querySelector('#min').innerHTML = (minutes < 10 ? '0' : '') + minutes + ':';
for (var i = 1; i < 7; i++) {
var p = eval('player' + i);
document.querySelector('#video' + i + 'delay').innerHTML = Math.round((d.getTime() / 1000) - Number(p.timeAsUtc()));
document.querySelector('#video' + i + 'delay').innerHTML = Math.round((d.getTime() / 1000) - Number(p.timeAsUTC()));
document.querySelector('#video' + i + 'buffer').innerHTML = p.getBufferLength() + 's';
}

Expand Down
2 changes: 1 addition & 1 deletion samples/live-streaming/synchronized-live-playback.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
document.querySelector('#min').innerHTML = (minutes < 10 ? '0' : '') + minutes + ':';
for (var i = 1; i < 3; i++) {
var p = eval('player' + i);
document.querySelector('#video' + i + 'delay').innerHTML = Math.round((d.getTime() / 1000) - Number(p.timeAsUtc()));
document.querySelector('#video' + i + 'delay').innerHTML = Math.round((d.getTime() / 1000) - Number(p.timeAsUTC()));
document.querySelector('#video' + i + 'buffer').innerHTML = p.getBufferLength() + 's';
}

Expand Down
4 changes: 2 additions & 2 deletions src/streaming/MediaPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ function MediaPlayer() {
* @memberof module:MediaPlayer
* @instance
*/
function timeAsUtc() {
function timeAsUTC() {
if (!playbackInitialized) {
throw PLAYBACK_NOT_INITIALIZED_ERROR;
}
Expand Down Expand Up @@ -2833,7 +2833,7 @@ function MediaPlayer() {
setVolume,
setXHRWithCredentialsForType,
time,
timeAsUtc,
timeAsUTC,
timeInDvrWindow,
trigger,
triggerSteeringRequest,
Expand Down
8 changes: 4 additions & 4 deletions test/unit/test/streaming/streaming.MediaPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ describe('MediaPlayer', function () {
expect(player.duration).to.throw(PLAYBACK_NOT_INITIALIZED_ERROR);
});

it('Method timeAsUtc should throw an exception', function () {
expect(player.timeAsUtc).to.throw(PLAYBACK_NOT_INITIALIZED_ERROR);
it('Method timeAsUTC should throw an exception', function () {
expect(player.timeAsUTC).to.throw(PLAYBACK_NOT_INITIALIZED_ERROR);
});

it('Method getDvrWindow should throw an exception', function () {
Expand Down Expand Up @@ -457,8 +457,8 @@ describe('MediaPlayer', function () {
expect(dvrWindow.size).to.be.equal(30);
});

it('timeAsUtc should return time() VoD content', function () {
let time = player.timeAsUtc();
it('timeAsUTC should return time() VoD content', function () {
let time = player.timeAsUTC();
expect(time).to.be.NaN
});

Expand Down

0 comments on commit b1fe6d6

Please sign in to comment.