Skip to content

Commit

Permalink
Update player when width or height changes
Browse files Browse the repository at this point in the history
  • Loading branch information
seniorapple committed Jul 25, 2016
1 parent 9020dc6 commit 4fa974c
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/ReactPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export default class ReactPlayer extends Component {
return (
this.props.url !== nextProps.url ||
this.props.playing !== nextProps.playing ||
this.props.volume !== nextProps.volume
this.props.volume !== nextProps.volume ||
this.props.height !== nextProps.height ||
this.props.width !== nextProps.width
)
}
seekTo = fraction => {
Expand All @@ -32,17 +34,10 @@ export default class ReactPlayer extends Component {
}
progress = () => {
if (this.props.url && this.refs.player) {
let progress = {}
const loaded = this.refs.player.getFractionLoaded()
const played = this.refs.player.getFractionPlayed()
if (loaded !== null && loaded !== this.prevLoaded) {
progress.loaded = this.prevLoaded = loaded
}
if (played !== null && played !== this.prevPlayed && this.props.playing) {
progress.played = this.prevPlayed = played
}
if (progress.loaded || progress.played) {
this.props.onProgress(progress)
if (loaded || played) {
this.props.onProgress({ loaded, played })
}
}
this.progressTimeout = setTimeout(this.progress, this.props.progressFrequency)
Expand Down

0 comments on commit 4fa974c

Please sign in to comment.