UNPKG

stream-chat-react

Version:

React components to create chat conversations or livestream style chat

1 lines 1.59 kB
{"version":3,"file":"ReactPlayerWrapper.d2ae5941.mjs","names":[],"sources":["../../src/components/VideoPlayer/ReactPlayerWrapper.tsx"],"sourcesContent":["import ReactPlayerImport from 'react-player';\n\nimport type { VideoPlayerProps } from './VideoPlayer';\n\n// react-player ships as CJS with the component on `exports.default`. Some\n// bundler/interop setups (e.g. Vite serving our built ESM as a linked workspace\n// dependency) hand back the module namespace `{ default }` instead of the\n// component itself, which makes React throw \"Element type is invalid ... got:\n// object\". Unwrap the default defensively so it works regardless of interop.\nconst ReactPlayer =\n (ReactPlayerImport as unknown as { default?: typeof ReactPlayerImport }).default ??\n ReactPlayerImport;\n\n/**\n * Default-exported so `VideoPlayer` can code-split it via `React.lazy`, keeping\n * `react-player` (~2 MB) out of the SDK's eager import graph — it is fetched\n * only when a default video player actually renders.\n */\nconst ReactPlayerWrapper = ({ isPlaying, thumbnailUrl, videoUrl }: VideoPlayerProps) => (\n <ReactPlayer\n className='react-player'\n config={{ file: { attributes: { poster: thumbnailUrl } } }}\n controls\n height='100%'\n playing={isPlaying}\n url={videoUrl}\n width='100%'\n />\n);\n\nexport default ReactPlayerWrapper;\n"],"mappings":";;;AASA,IAAM,cACH,kBAAwE,WACzE;;;;;;AAOF,IAAM,sBAAsB,EAAE,WAAW,cAAc,eACrD,oBAAC,aAAD;CACE,WAAU;CACV,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,aAAa,EAAE,EAAE;CACzD,UAAA;CACA,QAAO;CACP,SAAS;CACT,KAAK;CACL,OAAM;AACP,CAAA"}