|
1 | 1 | import React from 'react';
|
2 |
| -import PropTypes from 'prop-types'; |
3 | 2 | import loadSdk from './loadSdk';
|
4 | 3 |
|
5 | 4 | const {
|
@@ -417,194 +416,5 @@ function YouTube({
|
417 | 416 | );
|
418 | 417 | }
|
419 | 418 |
|
420 |
| -if (process.env.NODE_ENV !== 'production') { |
421 |
| - YouTube.propTypes = { |
422 |
| - /** |
423 |
| - * An 11-character string representing a YouTube video ID. |
424 |
| - */ |
425 |
| - video: PropTypes.string, |
426 |
| - /** |
427 |
| - * DOM ID for the player element. |
428 |
| - */ |
429 |
| - id: PropTypes.string, |
430 |
| - /** |
431 |
| - * CSS className for the player element. |
432 |
| - */ |
433 |
| - className: PropTypes.string, |
434 |
| - /** |
435 |
| - * Inline style for the player element. |
436 |
| - */ |
437 |
| - style: PropTypes.object, // eslint-disable-line react/forbid-prop-types |
438 |
| - /** |
439 |
| - * Width of the player element. |
440 |
| - */ |
441 |
| - width: PropTypes.oneOfType([ |
442 |
| - PropTypes.number, |
443 |
| - PropTypes.string, |
444 |
| - ]), |
445 |
| - /** |
446 |
| - * Height of the player element. |
447 |
| - */ |
448 |
| - height: PropTypes.oneOfType([ |
449 |
| - PropTypes.number, |
450 |
| - PropTypes.string, |
451 |
| - ]), |
452 |
| - |
453 |
| - /** |
454 |
| - * Pause the video. |
455 |
| - */ |
456 |
| - paused: PropTypes.bool, |
457 |
| - |
458 |
| - /** |
459 |
| - * YouTube host to use: 'https://www.youtube.com' or 'https://www.youtube-nocookie.com'. |
460 |
| - * |
461 |
| - * @default 'https://www.youtube.com' |
462 |
| - */ |
463 |
| - host: PropTypes.string, |
464 |
| - |
465 |
| - /** |
466 |
| - * The YouTube API will usually default this value correctly. It is exposed for completeness. |
467 |
| - */ |
468 |
| - origin: PropTypes.string, |
469 |
| - |
470 |
| - // Player parameters |
471 |
| - |
472 |
| - /** |
473 |
| - * Whether the video should start playing automatically. |
474 |
| - * |
475 |
| - * https://developers.google.com/youtube/player_parameters#autoplay |
476 |
| - */ |
477 |
| - autoplay: PropTypes.bool, |
478 |
| - /** |
479 |
| - * Whether to show captions below the video. |
480 |
| - * |
481 |
| - * https://developers.google.com/youtube/player_parameters#cc_load_policy |
482 |
| - */ |
483 |
| - showCaptions: PropTypes.bool, |
484 |
| - /** |
485 |
| - * Whether to show video controls. |
486 |
| - * |
487 |
| - * https://developers.google.com/youtube/player_parameters#controls |
488 |
| - */ |
489 |
| - controls: PropTypes.bool, |
490 |
| - /** |
491 |
| - * Ignore keyboard controls. |
492 |
| - * |
493 |
| - * https://developers.google.com/youtube/player_parameters#disablekb |
494 |
| - */ |
495 |
| - disableKeyboard: PropTypes.bool, |
496 |
| - /** |
497 |
| - * Whether to display the fullscreen button. |
498 |
| - * |
499 |
| - * https://developers.google.com/youtube/player_parameters#fs |
500 |
| - */ |
501 |
| - allowFullscreen: PropTypes.bool, |
502 |
| - /** |
503 |
| - * The player's interface language. The parameter value is an ISO 639-1 |
504 |
| - * two-letter language code or a fully specified locale. |
505 |
| - * |
506 |
| - * https://developers.google.com/youtube/player_parameters#hl |
507 |
| - */ |
508 |
| - lang: PropTypes.string, |
509 |
| - /** |
510 |
| - * Whether to show annotations on top of the video. |
511 |
| - * |
512 |
| - * https://developers.google.com/youtube/player_parameters#iv_load_policy |
513 |
| - */ |
514 |
| - annotations: PropTypes.bool, |
515 |
| - /** |
516 |
| - * Time in seconds at which to start playing the video. |
517 |
| - * |
518 |
| - * https://developers.google.com/youtube/player_parameters#start |
519 |
| - */ |
520 |
| - startSeconds: PropTypes.number, |
521 |
| - /** |
522 |
| - * Time in seconds at which to stop playing the video. |
523 |
| - * |
524 |
| - * https://developers.google.com/youtube/player_parameters#end |
525 |
| - */ |
526 |
| - endSeconds: PropTypes.number, |
527 |
| - /** |
528 |
| - * Remove most YouTube logos from the player. |
529 |
| - * |
530 |
| - * https://developers.google.com/youtube/player_parameters#modestbranding |
531 |
| - */ |
532 |
| - modestBranding: PropTypes.bool, |
533 |
| - /** |
534 |
| - * Whether to play the video inline on iOS, instead of fullscreen. |
535 |
| - * |
536 |
| - * https://developers.google.com/youtube/player_parameters#playsinline |
537 |
| - */ |
538 |
| - playsInline: PropTypes.bool, |
539 |
| - /** |
540 |
| - * Whether to show related videos after the video is over. |
541 |
| - * |
542 |
| - * https://developers.google.com/youtube/player_parameters#rel |
543 |
| - */ |
544 |
| - showRelatedVideos: PropTypes.bool, |
545 |
| - |
546 |
| - /** |
547 |
| - * The playback volume, **as a number between 0 and 1**. |
548 |
| - */ |
549 |
| - volume: PropTypes.number, |
550 |
| - |
551 |
| - /** |
552 |
| - * Whether the video's sound should be muted. |
553 |
| - */ |
554 |
| - muted: PropTypes.bool, |
555 |
| - |
556 |
| - /** |
557 |
| - * Playback speed. |
558 |
| - * |
559 |
| - * https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate |
560 |
| - */ |
561 |
| - playbackRate: PropTypes.number, |
562 |
| - |
563 |
| - // Events |
564 |
| - |
565 |
| - /** |
566 |
| - * Sent when the YouTube player API has loaded. |
567 |
| - */ |
568 |
| - onReady: PropTypes.func as PropTypes.Requireable<YT.PlayerEventHandler<YT.PlayerEvent>>, |
569 |
| - /** |
570 |
| - * Sent when the player triggers an error. |
571 |
| - */ |
572 |
| - onError: PropTypes.func as PropTypes.Requireable<YT.PlayerEventHandler<YT.OnErrorEvent>>, |
573 |
| - /** |
574 |
| - * Sent when the video is cued and ready to play. |
575 |
| - */ |
576 |
| - onCued: PropTypes.func as PropTypes.Requireable<YT.PlayerEventHandler<YT.OnStateChangeEvent>>, |
577 |
| - /** |
578 |
| - * Sent when the video is buffering. |
579 |
| - */ |
580 |
| - onBuffering: PropTypes.func as PropTypes.Requireable< |
581 |
| - YT.PlayerEventHandler<YT.OnStateChangeEvent> |
582 |
| - >, |
583 |
| - /** |
584 |
| - * Sent when playback has been started or resumed. |
585 |
| - */ |
586 |
| - onPlaying: PropTypes.func as PropTypes.Requireable< |
587 |
| - YT.PlayerEventHandler<YT.OnStateChangeEvent> |
588 |
| - >, |
589 |
| - /** |
590 |
| - * Sent when playback has been paused. |
591 |
| - */ |
592 |
| - onPause: PropTypes.func as PropTypes.Requireable<YT.PlayerEventHandler<YT.OnStateChangeEvent>>, |
593 |
| - /** |
594 |
| - * Sent when playback has stopped. |
595 |
| - */ |
596 |
| - onEnd: PropTypes.func as PropTypes.Requireable<YT.PlayerEventHandler<YT.OnStateChangeEvent>>, |
597 |
| - onStateChange: PropTypes.func as PropTypes.Requireable< |
598 |
| - YT.PlayerEventHandler<YT.OnStateChangeEvent> |
599 |
| - >, |
600 |
| - onPlaybackRateChange: PropTypes.func as PropTypes.Requireable< |
601 |
| - YT.PlayerEventHandler<YT.OnPlaybackRateChangeEvent> |
602 |
| - >, |
603 |
| - onPlaybackQualityChange: PropTypes.func as PropTypes.Requireable< |
604 |
| - YT.PlayerEventHandler<YT.OnPlaybackQualityChangeEvent> |
605 |
| - >, |
606 |
| - }; |
607 |
| -} |
608 |
| - |
609 | 419 | export { useYouTube };
|
610 | 420 | export default YouTube;
|
0 commit comments