Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Neil committed Feb 23, 2018
1 parent 1233e13 commit d3c62b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/sync-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,11 @@ export default class SyncController extends videojs.EventTarget {
* @param {Playlist} playlist - The currently active playlist
*/
setDateTimeMapping(playlist) {
if (!this.datetimeToDisplayTime && playlist.dateTimeObject) {
let playlistTimestamp = playlist.dateTimeObject.getTime() / 1000;
if (!this.datetimeToDisplayTime &&
playlist.segments &&
playlist.segments.length &&
playlist.segments[0].dateTimeObject) {
let playlistTimestamp = playlist.segments[0].dateTimeObject.getTime() / 1000;

this.datetimeToDisplayTime = -playlistTimestamp;
}
Expand Down
4 changes: 2 additions & 2 deletions test/sync-controller.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ QUnit.test('returns correct sync point for ProgramDateTime strategy', function(a

assert.equal(syncPoint, null, 'no syncpoint when datetimeToDisplayTime not set');

playlist.dateTimeObject = datetime;
playlist.segments[0].dateTimeObject = datetime;

this.syncController.setDateTimeMapping(playlist);

Expand All @@ -56,7 +56,7 @@ QUnit.test('returns correct sync point for ProgramDateTime strategy', function(a

assert.equal(syncPoint, null, 'no syncpoint when datetimeObject not set on playlist');

newPlaylist.dateTimeObject = new Date(2012, 11, 12, 12, 12, 22);
newPlaylist.segments[0].dateTimeObject = new Date(2012, 11, 12, 12, 12, 22);

syncPoint = strategy.run(this.syncController, newPlaylist, duration, timeline);

Expand Down

0 comments on commit d3c62b0

Please sign in to comment.