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'
8
8
import Player from './Player'
9
9
10
10
const 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
14
11
const 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
-
20
12
const customPlayers = [ ]
21
13
22
14
export const createReactPlayer = ( players , fallback ) => {
@@ -171,6 +163,12 @@ export const createReactPlayer = (players, fallback) => {
171
163
const { showPreview } = this . state
172
164
const attributes = this . getAttributes ( url )
173
165
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
+
174
172
return (
175
173
< Wrapper ref = { wrapperRef } style = { { ...style , width, height } } { ...attributes } >
176
174
< UniversalSuspense fallback = { fallback } >
You can’t perform that action at this time.
0 commit comments