Issue when using multiple players
See original GitHub issueHi, I’m using react-jPlayer for playing various items inside the same page. Basically I want each player to have its own state and I’m giving it an id based on the element that it will be playing, the first time I load the players it works well, but once I go to a different page where additional players are loaded I get an error from mapStateToProps where it’s trying to get media from undefined, as if it was trying to access a player id that doesn’t exist from the reducer.
Here’s the error:
TypeError: Cannot read property 'media' of undefined at Function.mapStateToProps [as mapToProps] (jPlayerContainer.js:36)
I’m wrapping the player inside a component that has additional logic for loading the files, but basically I’m initializing with the corresponding id on componentWillMount.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
Have you had a look at this?
https://github.com/jplayer/react-jPlayer-examples/tree/master/jPlayers/MultiplePlayers
Nope, I stopped trying and implemented my own solution using a native player 😦