Skip to content

Commit

Permalink
Be a bit more const-friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
cookpete committed Nov 13, 2015
1 parent 4cec3f9 commit a15700a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/ReactPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ export default class ReactPlayer extends Component {
return players.find(Player => Player.canPlay(url))
}
seekTo = fraction => {
let player = this.refs.player
const player = this.refs.player
if (player) {
player.seekTo(fraction)
}
}
render () {
let Player = this.state.Player
let style = {
const Player = this.state.Player
const style = {
width: this.props.width,
height: this.props.height
}
Expand Down
4 changes: 2 additions & 2 deletions src/players/Base.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export default class Base extends Component {
}
update = () => {
let progress = {}
let loaded = this.getFractionLoaded()
let played = this.getFractionPlayed()
const loaded = this.getFractionLoaded()
const played = this.getFractionPlayed()
if (!this.prevLoaded || loaded !== this.prevLoaded) {
progress.loaded = this.prevLoaded = loaded
}
Expand Down
4 changes: 2 additions & 2 deletions src/players/SoundCloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class SoundCloud extends Base {
this.getSDK().then(SC => {
this.getSongData(url).then(data => {
if (url !== this.props.url) return // Abort if url changes during async requests
let image = data.artwork_url || data.user.avatar_url
const image = data.artwork_url || data.user.avatar_url
if (image) {
this.setState({ image: image.replace('-large', '-t500x500') })
}
Expand Down Expand Up @@ -107,7 +107,7 @@ export default class SoundCloud extends Base {
return this.player.getLoadedPosition() / this.player.getDuration()
}
render () {
let style = {
const style = {
height: '100%',
backgroundImage: this.state.image ? 'url(' + this.state.image + ')' : null,
backgroundSize: 'cover',
Expand Down
4 changes: 2 additions & 2 deletions src/players/YouTube.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class YouTube extends Base {
})
}
play (url) {
let id = url && url.match(MATCH_URL)[1]
const id = url && url.match(MATCH_URL)[1]
if (this.player) {
if (id) {
this.player.loadVideoById(id)
Expand All @@ -63,7 +63,7 @@ export default class YouTube extends Base {
})
}
onStateChange = state => {
let YT = window[SDK_GLOBAL]
const YT = window[SDK_GLOBAL]
if (state.data === YT.PlayerState.PLAYING) this.props.onPlay()
if (state.data === YT.PlayerState.PAUSED) this.props.onPause()
if (state.data === YT.PlayerState.BUFFERING) this.props.onBuffer()
Expand Down

0 comments on commit a15700a

Please sign in to comment.