11// Import required modules and dependencies
2+ import $ from 'jquery' ;
3+ import _ from 'underscore' ;
24import { VideoStorage } from './video_storage' ;
5+ import { VideoPoster } from './poster' ;
6+ import { VideoTranscriptDownloadHandler } from './video_accessible_menu' ;
7+
38// TODO: Uncomment the imports
49// import { initialize } from './initialize'; // Assuming this function is imported
510// import {
@@ -23,21 +28,23 @@ import {VideoStorage} from './video_storage';
2328// VideoPlaySkipControl,
2429// VideoSkipControl,
2530// VideoEventsBumperPlugin,
26- // VideoPoster,
2731// VideoSocialSharing,
28- // VideoAccessibleMenu,
2932// VideoBumper,
3033// } from './video_modules'; // Assuming all necessary modules are grouped here
3134
35+ // Stub gettext if the runtime doesn't provide it
36+ if ( typeof window . gettext === 'undefined' ) {
37+ window . gettext = function ( text ) {
38+ return text ;
39+ } ;
40+ }
41+
42+
3243'use strict' ;
3344
3445console . log ( 'In video_block_main.js file' ) ;
3546
36- ( function ( require , $ ) {
37- // TODO: Following code needs to be reviewed, why we are not getting $
38- if ( ! $ ) {
39- $ = window . jQuery ;
40- }
47+ ( function ( ) {
4148 var youtubeXhr = null ;
4249 var oldVideo = window . Video ;
4350
@@ -113,34 +120,34 @@ console.log('In video_block_main.js file');
113120 } ;
114121 } ;
115122
116- // VideoAccessibleMenu (el, {
117- // storage: storage,
118- // saveStateUrl: state.metadata.saveStateUrl,
119- // });
123+ VideoTranscriptDownloadHandler ( el , {
124+ storage : storage ,
125+ saveStateUrl : state . metadata . saveStateUrl ,
126+ } ) ;
120127
121128 // VideoSocialSharing(el);
122129
123130 if ( bumperMetadata ) {
124- // VideoPoster(el, {
125- // poster: el.data('poster'),
126- // onClick: _.once(function () {
127- // const mainVideoPlayer = player(state);
128- //
129- // if (storage.getItem('isBumperShown')) {
130- // mainVideoPlayer();
131- // } else {
132- // const bumperState = getBumperState(bumperMetadata);
133- // const bumper = new VideoBumper(player(bumperState), bumperState);
134- //
135- // state.bumperState = bumperState;
136- //
137- // bumper.getPromise().then(() => {
138- // delete state.bumperState;
139- // mainVideoPlayer();
140- // });
141- // }
142- // }),
143- // });
131+ VideoPoster ( el , {
132+ poster : el . data ( 'poster' ) ,
133+ onClick : _ . once ( function ( ) {
134+ const mainVideoPlayer = player ( state ) ;
135+
136+ if ( storage . getItem ( 'isBumperShown' ) ) {
137+ mainVideoPlayer ( ) ;
138+ } else {
139+ const bumperState = getBumperState ( bumperMetadata ) ;
140+ const bumper = new VideoBumper ( player ( bumperState ) , bumperState ) ;
141+
142+ state . bumperState = bumperState ;
143+
144+ bumper . getPromise ( ) . then ( ( ) => {
145+ delete state . bumperState ;
146+ mainVideoPlayer ( ) ;
147+ } ) ;
148+ }
149+ } ) ,
150+ } ) ;
144151 } else {
145152 // TODO: Uncomment following initialize method calling
146153 // initialize(state, element);
0 commit comments