video-react-new 0.19.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,785 @@
1
+ import React, { ReactEventHandler, ReactNode } from 'react';
2
+
3
+ declare module 'video-react-new' {
4
+ type PreloadType = 'auto' | 'metadata' | 'none';
5
+
6
+ interface PlayerPropsType {
7
+ children?: any;
8
+
9
+ width?: string | number;
10
+ height?: string | number;
11
+ fluid?: boolean; // = true;
12
+ muted?: boolean; // = false;
13
+ playsInline?: boolean; // = false;
14
+ aspectRatio?: string; // = 'auto';
15
+ className?: string;
16
+ videoId?: string;
17
+
18
+ startTime?: number;
19
+ loop?: boolean;
20
+ autoPlay?: boolean;
21
+ src?: string;
22
+ poster?: string;
23
+ preload?: PreloadType; // = 'auto';
24
+
25
+ onLoadStart?: ReactEventHandler;
26
+ onWaiting?: ReactEventHandler;
27
+ onCanPlay?: ReactEventHandler;
28
+ onCanPlayThrough?: ReactEventHandler;
29
+ onPlaying?: ReactEventHandler;
30
+ onEnded?: ReactEventHandler;
31
+ onSeeking?: ReactEventHandler;
32
+ onSeeked?: ReactEventHandler;
33
+ onPlay?: ReactEventHandler;
34
+ onPause?: ReactEventHandler;
35
+ onProgress?: ReactEventHandler;
36
+ onDurationChange?: ReactEventHandler;
37
+ onError?: ReactEventHandler;
38
+ onSuspend?: ReactEventHandler;
39
+ onAbort?: ReactEventHandler;
40
+ onEmptied?: ReactEventHandler;
41
+ onStalled?: ReactEventHandler;
42
+ onLoadedMetadata?: ReactEventHandler;
43
+ onLoadedData?: ReactEventHandler;
44
+ onTimeUpdate?: ReactEventHandler;
45
+ onRateChange?: ReactEventHandler;
46
+ onVolumeChange?: ReactEventHandler;
47
+
48
+ store?: object;
49
+ }
50
+
51
+ class Player extends React.Component<PlayerPropsType> {
52
+ readonly video: Video;
53
+
54
+ getDefaultChildren(originalChildren): Array<React.Component>;
55
+
56
+ getChildren(props): Array<React.Component>;
57
+
58
+ setWidthOrHeight(style: object, name: string, value: string | number);
59
+
60
+ getStyle(): object;
61
+
62
+ // get redux state
63
+ // { player, operation }
64
+ getState(): object;
65
+
66
+ // get playback rate
67
+ get playbackRate(): number;
68
+
69
+ // set playback rate
70
+ // speed of video
71
+ set playbackRate(rate: number);
72
+
73
+ get muted(): boolean;
74
+
75
+ set muted(val: boolean);
76
+
77
+ get volume(): number;
78
+
79
+ set volume(val: number);
80
+
81
+ // video width
82
+ get videoWidth(): number;
83
+
84
+ // video height
85
+ get videoHeight(): number;
86
+
87
+ // play the video
88
+ play();
89
+
90
+ // pause the video
91
+ pause();
92
+
93
+ // Change the video source and re-load the video:
94
+ load();
95
+
96
+ // Add a new text track to the video
97
+ addTextTrack(
98
+ kind: TextTrackKind,
99
+ label?: string,
100
+ language?: string
101
+ ): TextTrack;
102
+
103
+ // Check if your browser can play different types of video:
104
+ canPlayType(type: string): CanPlayTypeResult;
105
+
106
+ // seek video by time
107
+ seek(time: number);
108
+
109
+ // jump forward x seconds
110
+ forward(seconds: number);
111
+
112
+ // jump back x seconds
113
+ replay(seconds: number);
114
+
115
+ // enter or exist full screen
116
+ toggleFullscreen();
117
+
118
+ // subscribe to player state change
119
+ subscribeToStateChange(listener: (state: any, prevState: any) => void);
120
+ }
121
+
122
+ interface VideoPropsType {
123
+ actions?: object;
124
+ player?: object;
125
+ children?: any;
126
+ startTime?: number;
127
+ loop?: boolean;
128
+ muted?: boolean;
129
+ autoPlay?: boolean;
130
+ playsInline?: boolean;
131
+ src?: string;
132
+ poster?: string;
133
+ className?: string;
134
+ preload?: PreloadType;
135
+ crossOrigin?: string;
136
+
137
+ onLoadStart?: ReactEventHandler;
138
+ onWaiting?: ReactEventHandler;
139
+ onCanPlay?: ReactEventHandler;
140
+ onCanPlayThrough?: ReactEventHandler;
141
+ onPlaying?: ReactEventHandler;
142
+ onEnded?: ReactEventHandler;
143
+ onSeeking?: ReactEventHandler;
144
+ onSeeked?: ReactEventHandler;
145
+ onPlay?: ReactEventHandler;
146
+ onPause?: ReactEventHandler;
147
+ onProgress?: ReactEventHandler;
148
+ onDurationChange?: ReactEventHandler;
149
+ onError?: ReactEventHandler;
150
+ onSuspend?: ReactEventHandler;
151
+ onAbort?: ReactEventHandler;
152
+ onEmptied?: ReactEventHandler;
153
+ onStalled?: ReactEventHandler;
154
+ onLoadedMetadata?: ReactEventHandler;
155
+ onLoadedData?: ReactEventHandler;
156
+ onTimeUpdate?: ReactEventHandler;
157
+ onRateChange?: ReactEventHandler;
158
+ onVolumeChange?: ReactEventHandler;
159
+ onResize?: ReactEventHandler;
160
+ }
161
+
162
+ class Video extends React.Component<VideoPropsType> {
163
+ // get all video properties
164
+ getProperties(): any;
165
+
166
+ // get playback rate
167
+ get playbackRate(): number;
168
+
169
+ // set playback rate
170
+ // speed of video
171
+ set playbackRate(rate: number);
172
+
173
+ get muted(): boolean;
174
+
175
+ set muted(val: boolean);
176
+
177
+ get volume(): number;
178
+
179
+ set volume(val: number);
180
+
181
+ // video width
182
+ get videoWidth(): number;
183
+
184
+ // video height
185
+ get videoHeight(): number;
186
+
187
+ // play the video
188
+ play();
189
+
190
+ // pause the video
191
+ pause();
192
+
193
+ // Change the video source and re-load the video:
194
+ load();
195
+
196
+ // Add a new text track to the video
197
+ addTextTrack(
198
+ kind: TextTrackKind,
199
+ label?: string,
200
+ language?: string
201
+ ): TextTrack;
202
+
203
+ // Check if your browser can play different types of video:
204
+ canPlayType(type: string): CanPlayTypeResult;
205
+
206
+ // toggle play
207
+ togglePlay();
208
+
209
+ // seek video by time
210
+ seek(time: number);
211
+
212
+ // jump forward x seconds
213
+ forward(seconds: number);
214
+
215
+ // jump back x seconds
216
+ replay(seconds: number);
217
+
218
+ // enter or exist full screen
219
+ toggleFullscreen();
220
+ }
221
+
222
+ interface BigPlayButtonPropsType {
223
+ actions?: object;
224
+ player?: object;
225
+ position?: 'center' | 'left-top'; // = 'left';
226
+ className?: string;
227
+ }
228
+
229
+ class BigPlayButton extends React.Component<BigPlayButtonPropsType> {}
230
+
231
+ interface LoadingSpinnerPropsType {
232
+ player?: object;
233
+ className?: string;
234
+ }
235
+ class LoadingSpinner extends React.Component<LoadingSpinnerPropsType> {}
236
+
237
+ interface PosterImagePropsType {
238
+ poster?: string;
239
+ player?: object;
240
+ actions?: object;
241
+ className?: string;
242
+ }
243
+ class PosterImage extends React.Component<PosterImagePropsType> {}
244
+
245
+ interface BezelPropsType {
246
+ manager?: object;
247
+ className?: string;
248
+ }
249
+ class Bezel extends React.Component<BezelPropsType> {}
250
+
251
+ interface ShortcutPropsType {
252
+ clickable?: boolean; // = true;
253
+ dblclickable?: boolean; // = true;
254
+ manager?: object;
255
+ actions?: object;
256
+ player?: object;
257
+ shortcuts?: Array<any>;
258
+ }
259
+ class Shortcut extends React.Component<ShortcutPropsType> {}
260
+
261
+ interface ControlBarPropsType {
262
+ children?: any;
263
+ autoHide?: boolean; // = true;
264
+ autoHideTime?: number; // used in Player
265
+ disableDefaultControls?: boolean;
266
+ disableCompletely?: boolean; // = false;
267
+ className?: string;
268
+ }
269
+ class ControlBar extends React.Component<ControlBarPropsType> {}
270
+
271
+ interface PlayTogglePropsType {
272
+ actions?: object;
273
+ player?: object;
274
+ className?: string;
275
+ }
276
+ class PlayToggle extends React.Component<PlayTogglePropsType> {}
277
+
278
+ type ForwardSecondsType = 5 | 10 | 30;
279
+ interface ForwardControlPropsType {
280
+ actions?: object;
281
+ className?: string;
282
+ seconds?: ForwardSecondsType; // = 10;
283
+ }
284
+ class ForwardControl extends React.Component<ForwardControlPropsType> {}
285
+
286
+ interface ReplayControlPropsType {
287
+ actions?: object;
288
+ className?: string;
289
+ seconds?: ForwardSecondsType; // = 10;
290
+ }
291
+ class ReplayControl extends React.Component<ReplayControlPropsType> {}
292
+
293
+ interface FullscreenTogglePropsType {
294
+ actions?: object;
295
+ player?: object;
296
+ className?: string;
297
+ }
298
+ class FullscreenToggle extends React.Component<FullscreenTogglePropsType> {}
299
+
300
+ interface ProgressControlPropsType {
301
+ player?: object;
302
+ className?: string;
303
+ }
304
+ class ProgressControl extends React.Component<ProgressControlPropsType> {}
305
+
306
+ interface SeekBarPropsType {
307
+ player?: object;
308
+ mouseTime?: object;
309
+ actions?: object;
310
+ className?: string;
311
+ }
312
+ class SeekBar extends React.Component<SeekBarPropsType> {
313
+ /**
314
+ * Get percentage of video played
315
+ *
316
+ * @return {Number} Percentage played
317
+ * @method getPercent
318
+ */
319
+ getPercent(): number;
320
+ }
321
+
322
+ interface SliderPropsType {
323
+ className?: string;
324
+ onMouseDown?: ReactEventHandler;
325
+ onMouseMove?: ReactEventHandler;
326
+ stepForward?: Function;
327
+ stepBack?: Function;
328
+ sliderActive?: ReactEventHandler;
329
+ sliderInactive?: ReactEventHandler;
330
+ onMouseUp?: ReactEventHandler;
331
+ onFocus?: ReactEventHandler;
332
+ onBlur?: ReactEventHandler;
333
+ onClick?: ReactEventHandler;
334
+ getPercent?: () => number;
335
+ vertical?: boolean;
336
+ children?: ReactNode;
337
+ label?: string;
338
+ valuenow?: string;
339
+ valuetext?: string;
340
+ }
341
+ class Slider extends React.Component<SliderPropsType> {}
342
+
343
+ interface PlayProgressBarPropsType {
344
+ currentTime?: number;
345
+ duration?: number;
346
+ percentage?: string;
347
+ className?: string;
348
+ }
349
+ class PlayProgressBar extends React.Component<PlayProgressBarPropsType> {}
350
+
351
+ interface LoadProgressBarPropsType {
352
+ duration?: number;
353
+ buffered?: object;
354
+ className?: string;
355
+ }
356
+ const LoadProgressBar: React.FC<LoadProgressBarPropsType>;
357
+
358
+ interface MouseTimeDisplayPropsType {
359
+ duration?: number;
360
+ mouseTime?: {
361
+ time: number;
362
+ position: number;
363
+ };
364
+ className?: string;
365
+ text?: string;
366
+ }
367
+ const MouseTimeDisplay: React.FC<MouseTimeDisplayPropsType>;
368
+
369
+ interface RemainingTimeDisplayPropsType {
370
+ player?: {
371
+ currentTime: number;
372
+ duration: number;
373
+ };
374
+ className?: string;
375
+ }
376
+ const RemainingTimeDisplay: React.FC<RemainingTimeDisplayPropsType>;
377
+
378
+ interface CurrentTimeDisplayPropsType {
379
+ player?: {
380
+ currentTime: number;
381
+ duration: number;
382
+ };
383
+ className?: string;
384
+ }
385
+ const CurrentTimeDisplay: React.FC<CurrentTimeDisplayPropsType>;
386
+
387
+ interface DurationDisplayPropsType {
388
+ player?: {
389
+ duration: number;
390
+ };
391
+ className?: string;
392
+ }
393
+ const DurationDisplay: React.FC<DurationDisplayPropsType>;
394
+
395
+ interface TimeDividerPropsType {
396
+ separator?: string;
397
+ className?: string;
398
+ }
399
+ const TimeDivider: React.FC<TimeDividerPropsType>;
400
+
401
+ interface VolumeMenuButtonPropsType {
402
+ player?: {
403
+ volume: number;
404
+ muted: boolean;
405
+ };
406
+ actions?: object;
407
+ vertical?: boolean;
408
+ className?: string;
409
+ alwaysShowVolume?: boolean;
410
+ }
411
+ class VolumeMenuButton extends React.Component<VolumeMenuButtonPropsType> {
412
+ get volumeLevel(): number;
413
+ }
414
+
415
+ interface PlaybackRateMenuButtonPropsType {
416
+ player?: object;
417
+ actions?: object;
418
+ rates?: Array<number>; // = [2, 1.5, 1.25, 1, 0.5, 0.25];
419
+ className?: string;
420
+ }
421
+ class PlaybackRateMenuButton extends React.Component<
422
+ PlaybackRateMenuButtonPropsType
423
+ > {}
424
+
425
+ interface ClosedCaptionButtonPropsType {
426
+ player?: object;
427
+ actions?: object;
428
+ className?: string;
429
+ offMenuText?: string; // = 'Off';
430
+ showOffMenu?: boolean; // = true;
431
+ kinds?: Array<string>; // = ['captions', 'subtitles']; // `kind`s of TextTrack to look for to associate it with this menu.
432
+ }
433
+ class ClosedCaptionButton extends React.Component<
434
+ ClosedCaptionButtonPropsType
435
+ > {}
436
+
437
+ class PlaybackRate extends React.Component {}
438
+
439
+ interface MenuButtonPropsType {
440
+ inline?: boolean;
441
+ items?: Array<any>;
442
+ className?: string;
443
+ onSelectItem?: ReactEventHandler;
444
+ children?: any;
445
+ selectedIndex?: number;
446
+ }
447
+ class MenuButton extends React.Component<MenuButtonPropsType> {}
448
+
449
+ namespace playerActions {
450
+ type OPERATE = 'video-react-new/OPERATE';
451
+ type FULLSCREEN_CHANGE = 'video-react-new/FULLSCREEN_CHANGE';
452
+ type PLAYER_ACTIVATE = 'video-react-new/PLAYER_ACTIVATE';
453
+ type USER_ACTIVATE = 'video-react-new/USER_ACTIVATE';
454
+
455
+ function handleFullscreenChange(
456
+ isFullscreen: boolean
457
+ ): {
458
+ type: FULLSCREEN_CHANGE;
459
+ isFullscreen;
460
+ };
461
+
462
+ function activate(
463
+ activity
464
+ ): {
465
+ type: PLAYER_ACTIVATE;
466
+ activity;
467
+ };
468
+
469
+ function userActivate(
470
+ activity
471
+ ): {
472
+ type: USER_ACTIVATE;
473
+ activity;
474
+ };
475
+
476
+ function play(operation: {
477
+ action: 'play';
478
+ source: string;
479
+ }): {
480
+ type: OPERATE;
481
+ operation;
482
+ };
483
+
484
+ function pause(operation: {
485
+ action: 'pause';
486
+ source: string;
487
+ }): {
488
+ type: OPERATE;
489
+ operation;
490
+ };
491
+
492
+ function togglePlay(operation?: {
493
+ action: 'toggle-play';
494
+ source: string;
495
+ }): {
496
+ type: OPERATE;
497
+ operation;
498
+ };
499
+
500
+ // seek video by time
501
+ function seek(
502
+ time: number,
503
+ operation?: {
504
+ action: 'seek';
505
+ source: string;
506
+ }
507
+ ): {
508
+ type: OPERATE;
509
+ operation;
510
+ };
511
+
512
+ // jump forward x seconds
513
+ function forward(
514
+ seconds: number,
515
+ operation?: {
516
+ action: string;
517
+ source: string;
518
+ }
519
+ ): {
520
+ type: OPERATE;
521
+ operation;
522
+ };
523
+
524
+ // jump back x seconds
525
+ function replay(
526
+ seconds: number,
527
+ operation?: {
528
+ action: string;
529
+ source: string;
530
+ }
531
+ ): {
532
+ type: OPERATE;
533
+ operation;
534
+ };
535
+
536
+ function changeRate(
537
+ rate: number,
538
+ operation?: {
539
+ action: 'change-rate';
540
+ source: string;
541
+ }
542
+ ): {
543
+ type: OPERATE;
544
+ operation;
545
+ };
546
+
547
+ function changeVolume(
548
+ volume: number,
549
+ operation?: {
550
+ action: 'change-volume';
551
+ source: string;
552
+ }
553
+ ): {
554
+ type: OPERATE;
555
+ operation;
556
+ };
557
+
558
+ function mute(
559
+ muted: boolean,
560
+ operation?: {
561
+ action: 'muted' | 'unmuted';
562
+ source: string;
563
+ }
564
+ ): {
565
+ type: OPERATE;
566
+ operation;
567
+ };
568
+
569
+ function toggleFullscreen(player): { type: string; [key: string]: any };
570
+ }
571
+
572
+ namespace videoActions {
573
+ type LOAD_START = 'video-react-new/LOAD_START';
574
+ type CAN_PLAY = 'video-react-new/CAN_PLAY';
575
+ type WAITING = 'video-react-new/WAITING';
576
+ type CAN_PLAY_THROUGH = 'video-react-new/CAN_PLAY_THROUGH';
577
+ type PLAYING = 'video-react-new/PLAYING';
578
+ type PLAY = 'video-react-new/PLAY';
579
+ type PAUSE = 'video-react-new/PAUSE';
580
+ type END = 'video-react-new/END';
581
+ type SEEKING = 'video-react-new/SEEKING';
582
+ type SEEKED = 'video-react-new/SEEKED';
583
+ type SEEKING_TIME = 'video-react-new/SEEKING_TIME';
584
+ type END_SEEKING = 'video-react-new/END_SEEKING';
585
+ type DURATION_CHANGE = 'video-react-new/DURATION_CHANGE';
586
+ type TIME_UPDATE = 'video-react-new/TIME_UPDATE';
587
+ type VOLUME_CHANGE = 'video-react-new/VOLUME_CHANGE';
588
+ type PROGRESS_CHANGE = 'video-react-new/PROGRESS_CHANGE';
589
+ type RATE_CHANGE = 'video-react-new/RATE_CHANGE';
590
+ type SUSPEND = 'video-react-new/SUSPEND';
591
+ type ABORT = 'video-react-new/ABORT';
592
+ type EMPTIED = 'video-react-new/EMPTIED';
593
+ type STALLED = 'video-react-new/STALLED';
594
+ type LOADED_META_DATA = 'video-react-new/LOADED_META_DATA';
595
+ type LOADED_DATA = 'video-react-new/LOADED_DATA';
596
+ type RESIZE = 'video-react-new/RESIZE';
597
+ type ERROR = 'video-react-new/ERROR';
598
+ type ACTIVATE_TEXT_TRACK = 'video-react-new/ACTIVATE_TEXT_TRACK';
599
+
600
+ function handleLoadStart(
601
+ videoProps
602
+ ): {
603
+ type: LOAD_START;
604
+ videoProps;
605
+ };
606
+
607
+ function handleCanPlay(
608
+ videoProps
609
+ ): {
610
+ type: CAN_PLAY;
611
+ videoProps;
612
+ };
613
+
614
+ function handleWaiting(
615
+ videoProps
616
+ ): {
617
+ type: WAITING;
618
+ videoProps;
619
+ };
620
+
621
+ function handleCanPlayThrough(
622
+ videoProps
623
+ ): {
624
+ type: CAN_PLAY_THROUGH;
625
+ videoProps;
626
+ };
627
+
628
+ function handlePlaying(
629
+ videoProps
630
+ ): {
631
+ type: PLAYING;
632
+ videoProps;
633
+ };
634
+
635
+ function handlePlay(
636
+ videoProps
637
+ ): {
638
+ type: PLAY;
639
+ videoProps;
640
+ };
641
+
642
+ function handlePause(
643
+ videoProps
644
+ ): {
645
+ type: PAUSE;
646
+ videoProps;
647
+ };
648
+
649
+ function handleEnd(
650
+ videoProps
651
+ ): {
652
+ type: END;
653
+ videoProps;
654
+ };
655
+
656
+ function handleSeeking(
657
+ videoProps
658
+ ): {
659
+ type: SEEKING;
660
+ videoProps;
661
+ };
662
+
663
+ function handleSeeked(
664
+ videoProps
665
+ ): {
666
+ type: SEEKED;
667
+ videoProps;
668
+ };
669
+
670
+ function handleDurationChange(
671
+ videoProps
672
+ ): {
673
+ type: DURATION_CHANGE;
674
+ videoProps;
675
+ };
676
+
677
+ function handleTimeUpdate(
678
+ videoProps
679
+ ): {
680
+ type: TIME_UPDATE;
681
+ videoProps;
682
+ };
683
+
684
+ function handleVolumeChange(
685
+ videoProps
686
+ ): {
687
+ type: VOLUME_CHANGE;
688
+ videoProps;
689
+ };
690
+
691
+ function handleProgressChange(
692
+ videoProps
693
+ ): {
694
+ type: PROGRESS_CHANGE;
695
+ videoProps;
696
+ };
697
+
698
+ function handleRateChange(
699
+ videoProps
700
+ ): {
701
+ type: RATE_CHANGE;
702
+ videoProps;
703
+ };
704
+
705
+ function handleSuspend(
706
+ videoProps
707
+ ): {
708
+ type: SUSPEND;
709
+ videoProps;
710
+ };
711
+
712
+ function handleAbort(
713
+ videoProps
714
+ ): {
715
+ type: ABORT;
716
+ videoProps;
717
+ };
718
+
719
+ function handleEmptied(
720
+ videoProps
721
+ ): {
722
+ type: EMPTIED;
723
+ videoProps;
724
+ };
725
+
726
+ function handleStalled(
727
+ videoProps
728
+ ): {
729
+ type: STALLED;
730
+ videoProps;
731
+ };
732
+
733
+ function handleLoadedMetaData(
734
+ videoProps
735
+ ): {
736
+ type: LOADED_META_DATA;
737
+ videoProps;
738
+ };
739
+
740
+ function handleLoadedData(
741
+ videoProps
742
+ ): {
743
+ type: LOADED_DATA;
744
+ videoProps;
745
+ };
746
+
747
+ function handleResize(
748
+ videoProps
749
+ ): {
750
+ type: RESIZE;
751
+ videoProps;
752
+ };
753
+
754
+ function handleError(
755
+ videoProps
756
+ ): {
757
+ type: ERROR;
758
+ videoProps;
759
+ };
760
+
761
+ function handleSeekingTime(
762
+ time
763
+ ): {
764
+ type: SEEKING_TIME;
765
+ time;
766
+ };
767
+
768
+ function handleEndSeeking(
769
+ time
770
+ ): {
771
+ type: END_SEEKING;
772
+ time;
773
+ };
774
+
775
+ function activateTextTrack(
776
+ textTrack
777
+ ): {
778
+ type: ACTIVATE_TEXT_TRACK;
779
+ textTrack;
780
+ };
781
+ }
782
+
783
+ function playerReducer(state: any, action: any);
784
+ function operationReducer(state: any, action: any);
785
+ }