@@ -3,7 +3,7 @@ import * as React from 'react';
33import { PlayFill } from '@gravity-ui/icons' ;
44import { Icon } from '@gravity-ui/uikit' ;
55import debounce from 'lodash/debounce' ;
6- import ReactPlayer from 'react-player' ;
6+ import _ReactPlayer from 'react-player' ;
77
88import { MobileContext } from '../../context/mobileContext' ;
99import { VideoContext } from '../../context/videoContext' ;
@@ -35,6 +35,11 @@ const b = block('ReactPlayer');
3535
3636const FPS = 60 ;
3737
38+ const ReactPlayer =
39+ 'default' in _ReactPlayer && _ReactPlayer . default
40+ ? ( _ReactPlayer . default as typeof _ReactPlayer )
41+ : _ReactPlayer ;
42+
3843export interface ReactPlayerBlockProps
3944 extends Omit < MediaVideoProps , 'loop' | 'src' > ,
4045 ClassNameProps {
@@ -99,7 +104,7 @@ export const ReactPlayerBlock = React.forwardRef<ReactPlayerBlockHandler, ReactP
99104 const ref = React . useRef < HTMLDivElement > ( null ) ;
100105 const buttonRef = React . useRef < HTMLButtonElement > ( null ) ;
101106
102- const [ playerRef , setPlayerRef ] = React . useState < ReactPlayer > ( ) ;
107+ const [ playerRef , setPlayerRef ] = React . useState < _ReactPlayer > ( ) ;
103108 const [ isPlaying , setIsPlaying ] = React . useState ( autoPlay ) ;
104109 const [ playedPercent , setPlayedPercent ] = React . useState < number > ( 0 ) ;
105110 const [ currentHeight , setCurrentHeight ] = React . useState ( height ) ;
@@ -310,7 +315,7 @@ export const ReactPlayerBlock = React.forwardRef<ReactPlayerBlockHandler, ReactP
310315 }
311316 } , [ changeMute , controls , customControlsType , ended , isPlaying , muted ] ) ;
312317
313- const onReady = React . useCallback ( ( player : ReactPlayer ) => {
318+ const onReady = React . useCallback ( ( player : _ReactPlayer ) => {
314319 setPlayerRef ( player ) ;
315320 const videoElement = player . getInternalPlayer ( ) ;
316321 const videoWidth = videoElement . videoWidth as number | undefined ;
0 commit comments