@@ -20,9 +20,7 @@ const DEFAULT_OPTIONS: interfaceDefaultOptions = {
20
20
playPause : true ,
21
21
progressBar : true ,
22
22
time : true ,
23
- seekTime : 5 ,
24
23
volume : true ,
25
- volumeStep : 0.1 ,
26
24
loop : false
27
25
} ,
28
26
video : {
@@ -31,9 +29,7 @@ const DEFAULT_OPTIONS: interfaceDefaultOptions = {
31
29
playPause : true ,
32
30
progressBar : true ,
33
31
time : true ,
34
- seekTime : 5 ,
35
32
volume : true ,
36
- volumeStep : 0.1 ,
37
33
fullscreen : true ,
38
34
poster : null ,
39
35
bigPlay : true ,
@@ -134,7 +130,6 @@ class Vlitejs {
134
130
135
131
this . onClickOnPlayer = this . onClickOnPlayer . bind ( this )
136
132
this . onDoubleClickOnPlayer = this . onDoubleClickOnPlayer . bind ( this )
137
- this . onKeydown = this . onKeydown . bind ( this )
138
133
this . onMousemove = this . onMousemove . bind ( this )
139
134
this . onChangeFullScreen = this . onChangeFullScreen . bind ( this )
140
135
@@ -207,7 +202,6 @@ class Vlitejs {
207
202
this . autoHideGranted && this . container . addEventListener ( 'mousemove' , this . onMousemove )
208
203
document . addEventListener ( this . supportFullScreen . changeEvent , this . onChangeFullScreen )
209
204
}
210
- this . container . addEventListener ( 'keydown' , this . onKeydown )
211
205
}
212
206
213
207
/**
@@ -245,57 +239,6 @@ class Vlitejs {
245
239
}
246
240
}
247
241
248
- /**
249
- * On keydown event on the media element
250
- * @param e Event listener datas
251
- */
252
- onKeydown ( e : KeyboardEvent ) {
253
- const activeElement = document . activeElement
254
- const { keyCode } = e
255
-
256
- // Stop and start the auto hide timer on selected key code
257
- if (
258
- [ 9 , 32 , 37 , 39 ] . includes ( keyCode ) &&
259
- this . autoHideGranted &&
260
- ( activeElement === this . container || activeElement ?. closest ( '.v-vlite' ) )
261
- ) {
262
- this . stopAutoHideTimer ( )
263
- this . startAutoHideTimer ( )
264
- }
265
-
266
- // Backward or forward video with arrow keys
267
- if (
268
- [ 37 , 39 ] . includes ( keyCode ) &&
269
- ( activeElement === this . container || activeElement === this . player . elements . progressBar )
270
- ) {
271
- // Prevent default behavior on input range
272
- e . preventDefault ( )
273
-
274
- if ( keyCode === 37 ) {
275
- this . fastForward ( 'backward' )
276
- } else if ( keyCode === 39 ) {
277
- this . fastForward ( 'forward' )
278
- }
279
- }
280
-
281
- // Increase or decrease volume with arrow keys
282
- if (
283
- [ 38 , 40 ] . includes ( keyCode ) &&
284
- ( activeElement === this . container || activeElement === this . player . elements . volume )
285
- ) {
286
- if ( keyCode === 38 ) {
287
- this . increaseVolume ( )
288
- } else if ( keyCode === 40 ) {
289
- this . decreaseVolume ( )
290
- }
291
- }
292
-
293
- // Toggle the media playback with spacebar key
294
- if ( keyCode === 32 && activeElement === this . container ) {
295
- this . player . controlBar . togglePlayPause ( e )
296
- }
297
- }
298
-
299
242
/**
300
243
* On mousemove on the player
301
244
*/
@@ -316,37 +259,6 @@ class Vlitejs {
316
259
}
317
260
}
318
261
319
- /**
320
- * Trigger the video fast forward (front and rear)
321
- * @param direction Direction (backward|forward)
322
- */
323
- fastForward ( direction : string ) {
324
- this . player . getCurrentTime ( ) . then ( ( seconds : number ) => {
325
- this . player . seekTo (
326
- direction === 'backward' ? seconds - this . options . seekTime : seconds + this . options . seekTime
327
- )
328
- } )
329
- }
330
-
331
- /**
332
- * Increase the player volume
333
- */
334
- increaseVolume ( ) {
335
- this . player . isMuted && this . player . unMute ( )
336
- this . player . getVolume ( ) . then ( ( volume : number ) => {
337
- this . player . setVolume ( Math . min ( Math . round ( ( volume + this . options . volumeStep ) * 10 ) / 10 , 1 ) )
338
- } )
339
- }
340
-
341
- /**
342
- * Decrease the player volume
343
- */
344
- decreaseVolume ( ) {
345
- this . player . getVolume ( ) . then ( ( volume : number ) => {
346
- this . player . setVolume ( Math . max ( Math . round ( ( volume - this . options . volumeStep ) * 10 ) / 10 , 0 ) )
347
- } )
348
- }
349
-
350
262
/**
351
263
* Stop the auto hide timer and show the video control bar
352
264
*/
@@ -372,8 +284,6 @@ class Vlitejs {
372
284
* Remove events listeners
373
285
*/
374
286
removeEvents ( ) {
375
- this . container . removeEventListener ( 'keydown' , this . onKeydown )
376
-
377
287
if ( this . type === 'video' ) {
378
288
this . container . removeEventListener ( 'click' , this . onClickOnPlayer )
379
289
this . container . removeEventListener ( 'dblclick' , this . onDoubleClickOnPlayer )
0 commit comments