Skip to content

Commit e1d1c03

Browse files
committed
chore: some fixes
1 parent 890e51f commit e1d1c03

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

xmodule/assets/video/public/js/01_initialize.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ import i18n from './00_i18n.js';
1616
import _ from 'underscore';
1717
import moment from 'moment';
1818

19-
// TODO: Review this removal of line
20-
// const moment = moment || window.moment;
21-
2219
/**
2320
* @function
2421
*
@@ -732,7 +729,8 @@ function youtubeId(speed) {
732729

733730
function getDuration() {
734731
try {
735-
return moment.duration(this.metadata[this.youtubeId()].duration, moment.ISO_8601).asSeconds();
732+
const safeMoment = typeof moment !== 'undefined' ? moment : window.moment;
733+
return safeMoment.duration(this.metadata[this.youtubeId()].duration, safeMoment.ISO_8601).asSeconds();
736734
} catch (err) {
737735
return _.result(this.metadata[this.youtubeId('1.0')], 'duration') || 0;
738736
}

xmodule/assets/video/public/js/10_main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ if (typeof window.gettext === 'undefined') {
3838

3939
(function () {
4040
let youtubeXhr = null;
41-
const oldVideo = window.Video;
4241

4342
window.Video = function (runtime, element) {
4443
console.log('In Video initialize method');
@@ -147,6 +146,7 @@ if (typeof window.gettext === 'undefined') {
147146
// TODO: Review following code and remove it as it's not needed anymore
148147
// Invoke the mock Video constructor so that the elements stored within it can be processed by the real
149148
// `window.Video` constructor.
149+
// const oldVideo = window.Video;
150150
// oldVideo(null, true);
151151

152152
}());

0 commit comments

Comments
 (0)