Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions xmodule/assets/video/public/js/time.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// eslint-disable-next-line no-shadow
function format(time, formatFull) {
var hours, minutes, seconds;

if (!_.isFinite(time) || time < 0) {
time = 0;
}

seconds = Math.floor(time);
minutes = Math.floor(seconds / 60);
hours = Math.floor(minutes / 60);
seconds %= 60;
minutes %= 60;

if (formatFull) {
return '' + _pad(hours) + ':' + _pad(minutes) + ':' + _pad(seconds % 60);
} else if (hours) {
return '' + hours + ':' + _pad(minutes) + ':' + _pad(seconds % 60);
} else {
return '' + minutes + ':' + _pad(seconds % 60);
}
}

function formatFull(time) {
// The returned value will not be user-facing. So no need for
// internationalization.
return format(time, true);
}

function convert(time, oldSpeed, newSpeed) {
// eslint-disable-next-line no-mixed-operators
return (time * oldSpeed / newSpeed).toFixed(3);
}

function _pad(number) {
if (number < 10) {
return '0' + number;
} else {
return '' + number;
}
}

export default {format, formatFull, convert};
73 changes: 37 additions & 36 deletions xmodule/assets/video/public/js/video_block_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,31 @@ import _ from 'underscore';
import {VideoStorage} from './video_storage';
import {VideoPoster} from './poster';
import {VideoTranscriptDownloadHandler} from './video_accessible_menu';
import {VideoSkipControl} from './skip_control';
import {VideoPlayPlaceholder} from './play_placeholder';
import {VideoPlaySkipControl} from './play_skip_control';
import {VideoPlayPauseControl} from './play_pause_control';
import {VideoSocialSharingHandler} from './video_social_sharing';
import {FocusGrabber} from './focus_grabber';
import {VideoCommands} from "./commands";
import {VideoEventsBumperPlugin} from "./events_bumper_plugin";
import {VideoEventsPlugin} from "./events_plugin";
import {VideoSaveStatePlugin} from "./save_state_plugin";


// TODO: Uncomment the imports
// import { initialize } from './initialize'; // Assuming this function is imported
// import {
// FocusGrabber,
// VideoControl,
// VideoPlayPlaceholder,
// VideoPlayPauseControl,
// VideoProgressSlider,
// VideoSpeedControl,
// VideoVolumeControl,
// VideoQualityControl,
// VideoFullScreen,
// VideoCaption,
// VideoCommands,
// VideoContextMenu,
// VideoSaveStatePlugin,
// VideoEventsPlugin,
// VideoCompletionHandler,
// VideoTranscriptFeedback,
// VideoAutoAdvanceControl,
// VideoPlaySkipControl,
// VideoSkipControl,
// VideoEventsBumperPlugin,
// VideoSocialSharing,
// VideoBumper,
// } from './video_modules'; // Assuming all necessary modules are grouped here

Expand Down Expand Up @@ -58,36 +57,37 @@ console.log('In video_block_main.js file');
const bumperMetadata = el.data('bumper-metadata');
const autoAdvanceEnabled = el.data('autoadvance-enabled') === 'True';

const mainVideoModules = [
FocusGrabber,
// VideoControl,
VideoPlayPlaceholder,
VideoPlayPauseControl,
// VideoProgressSlider,
// VideoSpeedControl,
// VideoVolumeControl,
// VideoQualityControl,
// VideoFullScreen,
// VideoCaption,
VideoCommands,
// VideoContextMenu,
VideoSaveStatePlugin,
VideoEventsPlugin,
// VideoCompletionHandler,
// VideoTranscriptFeedback,
// ].concat(autoAdvanceEnabled ? [VideoAutoAdvanceControl] : []);
]
const mainVideoModules = []
// TODO: Uncomment the code
// const mainVideoModules = [
// FocusGrabber,
// VideoControl,
// VideoPlayPlaceholder,
// VideoPlayPauseControl,
// VideoProgressSlider,
// VideoSpeedControl,
// VideoVolumeControl,
// VideoQualityControl,
// VideoFullScreen,
// VideoCaption,
// VideoCommands,
// VideoContextMenu,
// VideoSaveStatePlugin,
// VideoEventsPlugin,
// VideoCompletionHandler,
// VideoTranscriptFeedback,
// ].concat(autoAdvanceEnabled ? [VideoAutoAdvanceControl] : []);

const bumperVideoModules = [
// VideoControl,
VideoPlaySkipControl,
VideoSkipControl,
// VideoPlaySkipControl,
// VideoSkipControl,
// VideoVolumeControl,
// VideoCaption,
VideoCommands,
VideoSaveStatePlugin,
// VideoCommands,
// VideoSaveStatePlugin,
// VideoTranscriptFeedback,
VideoEventsBumperPlugin,
// VideoEventsBumperPlugin,
// VideoCompletionHandler,
];

Expand Down Expand Up @@ -125,7 +125,7 @@ console.log('In video_block_main.js file');
saveStateUrl: state.metadata.saveStateUrl,
});

VideoSocialSharingHandler(el);
// VideoSocialSharing(el);

if (bumperMetadata) {
VideoPoster(el, {
Expand Down Expand Up @@ -184,3 +184,4 @@ console.log('In video_block_main.js file');
// oldVideo(null, true);

}());

Loading
Loading