micnews / react-jw-player

A React Component API for JW Player

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't work with multiple videos on the same page, even with "useMultiplePlayerScripts={true}"

ronenmagid opened this issue · comments

when useMultiplePlayerScript isn't used only one video is visible and working (the last one used), the other video is simply never created.

<ReactJWPlayer
                        id={"player1"}
                        playerId= { "LDty3DAW" }
                        playerScript= { 'https://cdn.jwplayer.com/libraries/' +  'LDty3DAW' + '.js' }
                        playlist={ 'https://content.jwplatform.com/feeds/' + 'CaJO0RyF' + '.json'}
                        isAutoPlay={ true}
                        isMuted={ false }
                        width={ "100%" }
               
                        
                    <p>test test test</p>

                    <ReactJWPlayer
                        id={"player2"}
                        playerId= { "LDty3DAW" }
                        playerScript= { 'https://cdn.jwplayer.com/libraries/' +  'LDty3DAW' + '.js' }
                        playlist={ 'https://content.jwplatform.com/feeds/' + 'HBhbIy85' + '.json'}
                        isAutoPlay={ true}
                        isMuted={ false }
                        width={ "100%" }
                    />

when useMultiplePlayerScripts={true} is used react-jw-player crashes and plays nothing:

<ReactJWPlayer
                        id={"player1"}
                        playerId= { "LDty3DAW" }
                        playerScript= { 'https://cdn.jwplayer.com/libraries/' +  'LDty3DAW' + '.js' }
                        playlist={ 'https://content.jwplatform.com/feeds/' + 'CaJO0RyF' + '.json'}
                        isAutoPlay={ true}
                        isMuted={ false }
                        width={ "100%" }
                        useMultiplePlayerScripts={true}
                        />
                        
                    <p>test test test</p>

                    <ReactJWPlayer
                        id={"player2"}
                        playerId= { "LDty3DAW" }
                        playerScript= { 'https://cdn.jwplayer.com/libraries/' +  'LDty3DAW' + '.js' }
                        playlist={ 'https://content.jwplatform.com/feeds/' + 'HBhbIy85' + '.json'}
                        isAutoPlay={ true}
                        isMuted={ false }
                        width={ "100%" }
                        useMultiplePlayerScripts={true}
                    />

crash:

Uncaught TypeError: Cannot read property 'defaults' of undefined
    at setJWPlayerDefaults (set-jw-player-defaults.js:18)
    at ReactJWPlayer._initialize (react-jw-player.js:146)
    at ReactJWPlayer.componentDidMount (react-jw-player.js:102)
    at commitLifeCycles (react-dom.development.js:19814)
    at commitLayoutEffects (react-dom.development.js:22803)
    at HTMLUnknownElement.callCallback (react-dom.development.js:188)
    at HTMLUnknownElement.__trace__ (bugsnag.js:2230)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:237)
    at invokeGuardedCallback (react-dom.development.js:292)
    at commitRootImpl (react-dom.development.js:22541)

This makes React-Jw-Player unusable for our purposes, having multiple video players in a single page. we'll look for other solutions out there.

my mistake. sorry. please disregard. my unique Ids were not set up correctly.