File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -8,15 +8,7 @@ import { omit, lazy } from './utils'
88import Player from './Player'
99
1010const Preview = lazy ( ( ) => import ( /* webpackChunkName: 'reactPlayerPreview' */ './Preview' ) )
11-
12- const IS_BROWSER = typeof window !== 'undefined' && window . document && typeof document !== 'undefined'
13- const IS_GLOBAL = typeof global !== 'undefined' && global . window && global . window . document
1411const SUPPORTED_PROPS = Object . keys ( propTypes )
15-
16- // Return null when rendering on the server
17- // as Suspense is not supported yet
18- const UniversalSuspense = IS_BROWSER || IS_GLOBAL ? Suspense : ( ) => null
19-
2012const customPlayers = [ ]
2113
2214export const createReactPlayer = ( players , fallback ) => {
@@ -171,6 +163,12 @@ export const createReactPlayer = (players, fallback) => {
171163 const { showPreview } = this . state
172164 const attributes = this . getAttributes ( url )
173165 const wrapperRef = typeof Wrapper === 'string' ? this . references . wrapper : undefined
166+
167+ // Many React frameworks like Next.js support Suspense on the server but there are
168+ // others like Fresh that don't plan to support it. Users can disable Suspense
169+ // by setting the fallback prop to false.
170+ const UniversalSuspense = fallback === false ? ( { children } ) => children : Suspense
171+
174172 return (
175173 < Wrapper ref = { wrapperRef } style = { { ...style , width, height } } { ...attributes } >
176174 < UniversalSuspense fallback = { fallback } >
You can’t perform that action at this time.
0 commit comments