1
1
// VideoJS Plugins
2
2
3
3
var Button = videojs . getComponent ( 'Button' ) ;
4
- var MenuButton = videojs . getComponent ( 'MenuButton' ) ;
5
4
var SubtitlesButton = videojs . getComponent ( 'SubtitlesButton' ) ;
6
5
var MenuItem = videojs . getComponent ( 'MenuItem' ) ;
7
6
@@ -180,7 +179,7 @@ class CustomTrackMenuItem extends MenuItem {
180
179
let vtt = this . srt2webvtt ( text ) ;
181
180
return new File (
182
181
[ vtt ] ,
183
- '/temp .vtt' ,
182
+ 'loaded .vtt' ,
184
183
{ type : 'text/vtt' }
185
184
) ;
186
185
}
@@ -198,7 +197,7 @@ class CustomTrackMenuItem extends MenuItem {
198
197
const track = videojs ( 'video_player' ) . addRemoteTextTrack ( {
199
198
kind : 'subtitles' ,
200
199
language : '00' ,
201
- label : 'original' ,
200
+ label : i18n . __ ( 'Custom...' ) ,
202
201
mode : 'showing' ,
203
202
src : URL . createObjectURL ( file )
204
203
} , false ) ;
@@ -220,57 +219,3 @@ class CustomSubtitlesButton extends SubtitlesButton
220
219
}
221
220
}
222
221
videojs . registerComponent ( 'customSubtitlesButton' , CustomSubtitlesButton ) ;
223
-
224
- /**
225
- * Button for subtitles menu
226
- *
227
- * @extends MenuButton
228
- * @class SubtitlesButton
229
- */
230
- class CustomButton extends MenuButton {
231
- /**
232
- * Constructor for class
233
- *
234
- * @param {Player|Object } player The player
235
- * @param {Object= } options Button options
236
- * @param {string } options.direction back or forward
237
- * @param {Int } options.seconds number of seconds to seek
238
- */
239
- constructor ( player , options ) {
240
- super ( player , options ) ;
241
- if ( this . options_ . direction === 'forward' ) {
242
- this . controlText ( this . localize ( 'Seek forward {{seconds}} seconds' )
243
- . replace ( '{{seconds}}' , this . options_ . seconds ) ) ;
244
- } else if ( this . options_ . direction === 'back' ) {
245
- this . controlText ( this . localize ( 'Seek back {{seconds}} seconds' )
246
- . replace ( '{{seconds}}' , this . options_ . seconds ) ) ;
247
- }
248
- }
249
-
250
- /**
251
- * Return button class names which include the seek amount.
252
- *
253
- * @return {string } css cass string
254
- */
255
- buildCSSClass ( ) {
256
- return `vjs-subtitles-button ${ super . buildCSSClass ( ) } ` ;
257
- }
258
-
259
- /**
260
- * Seek with the button's configured offset
261
- */
262
- handleClick ( ) {
263
- console . log ( 'click!' ) ;
264
-
265
-
266
- // const now = this.player_.currentTime();
267
- //
268
- // if (this.options_.direction === 'forward') {
269
- // this.player_.currentTime(now + this.options_.seconds);
270
- // } else if (this.options_.direction === 'back') {
271
- // this.player_.currentTime(now - this.options_.seconds);
272
- // }
273
- }
274
- }
275
-
276
- videojs . registerComponent ( 'customButton' , CustomButton ) ;
0 commit comments