Skip to content

Commit

Permalink
Fix Vimeo fast switch bug
Browse files Browse the repository at this point in the history
Fixes #683
  • Loading branch information
cookpete committed Aug 10, 2019
1 parent ad5d6df commit 6acf69a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export default class Player extends Component {
}
componentWillReceiveProps (nextProps) {
// Invoke player methods based on incoming props
const { url, playing, volume, muted, playbackRate, pip, loop } = this.props
const { url, playing, volume, muted, playbackRate, pip, loop, activePlayer } = this.props
if (!isEqual(url, nextProps.url)) {
if (this.isLoading) {
if (this.isLoading && !activePlayer.forceLoad) {
console.warn(`ReactPlayer: the attempt to load ${nextProps.url} is being deferred until the player has loaded`)
this.loadOnReady = nextProps.url
return
Expand Down
1 change: 1 addition & 0 deletions src/players/Vimeo.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const MATCH_FILE_URL = /vimeo\.com\/external\/[0-9]+\..+/

export class Vimeo extends Component {
static displayName = 'Vimeo'
static forceLoad = true // Prevent checking isLoading when URL changes
static canPlay = url => {
if (MATCH_FILE_URL.test(url)) {
return false
Expand Down
2 changes: 1 addition & 1 deletion test/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test('player.load()', t => {

test('set loadOnReady', t => {
const stub = sinon.stub(console, 'warn')
const wrapper = shallow(<Player url='file.mp4' />)
const wrapper = shallow(<Player url='file.mp4' activePlayer={{}} />)
const instance = wrapper.instance()
const fake = sinon.fake()
instance.ref({ load: fake })
Expand Down

0 comments on commit 6acf69a

Please sign in to comment.