|
1 | 1 | import React, { lazy, Suspense, useEffect, useState } from 'react';
|
2 |
| -import merge from 'deepmerge'; |
3 | 2 |
|
4 | 3 | import { defaultProps } from './props.js';
|
5 | 4 | import Player from './Player.js';
|
@@ -33,8 +32,8 @@ export const createReactPlayer = (players: PlayerEntry[], playerFallback: Player
|
33 | 32 | return null;
|
34 | 33 | };
|
35 | 34 |
|
36 |
| - const ReactPlayer: ReactPlayer = React.forwardRef(({ children, ..._props } , ref) => { |
37 |
| - const props = merge(defaultProps, _props); |
| 35 | + const ReactPlayer: ReactPlayer = React.forwardRef((_props, ref) => { |
| 36 | + const props = { ...defaultProps, ..._props }; |
38 | 37 |
|
39 | 38 | const { src, slot, className, style, width, height, fallback, wrapper } = props;
|
40 | 39 | const [showPreview, setShowPreview] = useState(!!props.light);
|
@@ -83,19 +82,19 @@ export const createReactPlayer = (players: PlayerEntry[], playerFallback: Player
|
83 | 82 | activePlayer={player.player ?? (player as unknown as PlayerEntry['player'])}
|
84 | 83 | slot={wrapper ? undefined : slot}
|
85 | 84 | className={wrapper ? undefined : className}
|
86 |
| - style={wrapper |
87 |
| - ? { display: 'block', width: '100%', height: '100%' } |
88 |
| - : { display: 'block', width, height, ...style }} |
| 85 | + style={ |
| 86 | + wrapper |
| 87 | + ? { display: 'block', width: '100%', height: '100%' } |
| 88 | + : { display: 'block', width, height, ...style } |
| 89 | + } |
89 | 90 | config={config}
|
90 |
| - >{children}</Player> |
| 91 | + /> |
91 | 92 | );
|
92 | 93 | };
|
93 | 94 |
|
94 |
| - const Wrapper: ReactPlayerProps['wrapper'] = |
95 |
| - wrapper == null ? ForwardChildren : wrapper; |
| 95 | + const Wrapper: ReactPlayerProps['wrapper'] = wrapper == null ? ForwardChildren : wrapper; |
96 | 96 |
|
97 |
| - const UniversalSuspense = |
98 |
| - fallback === false ? ForwardChildren : Suspense; |
| 97 | + const UniversalSuspense = fallback === false ? ForwardChildren : Suspense; |
99 | 98 |
|
100 | 99 | return (
|
101 | 100 | <Wrapper slot={slot} className={className} style={{ width, height, ...style }}>
|
|
0 commit comments