File tree Expand file tree Collapse file tree
xmodule/assets/video/public/js Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,9 +16,6 @@ import i18n from './00_i18n.js';
1616import _ from 'underscore' ;
1717import 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
733730function 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 }
Original file line number Diff line number Diff 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} ( ) ) ;
You can’t perform that action at this time.
0 commit comments