Skip to content

Commit

Permalink
Add progressFrequency prop
Browse files Browse the repository at this point in the history
  • Loading branch information
webmiraclepro committed Apr 11, 2016
1 parent 674ca5b commit 16808ec
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Prop | Description
`width` | Sets the width of the player
`height` | Sets the height of the player
`className` | Pass in a `className` to set on the top level element
`progressFrequency` | The time between `onProgress` callbacks, in milliseconds

#### Callback props

Expand Down
4 changes: 1 addition & 3 deletions src/ReactPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import React, { Component } from 'react'
import { propTypes, defaultProps } from './props'
import players from './players'

const PROGRESS_FREQUENCY = 1000

export default class ReactPlayer extends Component {
static displayName = 'ReactPlayer';
static propTypes = propTypes;
Expand Down Expand Up @@ -48,7 +46,7 @@ export default class ReactPlayer extends Component {
this.props.onProgress(progress)
}
}
this.progressTimeout = setTimeout(this.progress, PROGRESS_FREQUENCY)
this.progressTimeout = setTimeout(this.progress, this.props.progressFrequency)
};
renderPlayer = (Player) => {
const active = Player.canPlay(this.props.url)
Expand Down
2 changes: 2 additions & 0 deletions src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const propTypes = {
width: PropTypes.oneOfType([ PropTypes.string, PropTypes.number ]),
height: PropTypes.oneOfType([ PropTypes.string, PropTypes.number ]),
className: PropTypes.string,
progressFrequency: PropTypes.number,
soundcloudConfig: PropTypes.shape({
clientId: PropTypes.string
}),
Expand All @@ -32,6 +33,7 @@ export const defaultProps = {
width: 640,
height: 360,
volume: 0.8,
progressFrequency: 1000,
soundcloudConfig: {
clientId: 'e8b6f84fbcad14c301ca1355cae1dea2'
},
Expand Down

0 comments on commit 16808ec

Please sign in to comment.