Skip to content

Commit

Permalink
update variable names in response to code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Fauntleroy committed Oct 20, 2015
1 parent 06bd5a9 commit 896a20a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ playing | Set to `true` or `false` to pause or play the media
volume | Sets the volume of the appropriate player
width | Sets the width of the player
height | Sets the height of the player
soundcloud | An object containing configuration for the SoundCloud player. Includes `clientId`, which can be used to override the default `client_id`
vimeo | An object containing configuration for the Vimeo player. Includes `iframeParams`, which maps to the [parameters accepted by the Vimeo iframe player](https://developer.vimeo.com/player/embedding#universal-parameters)
youtube | An object containing configuration for the YouTube player. Includes `playerVars`, which maps to the [parameters accepted by the YouTube iframe player](https://developers.google.com/youtube/player_parameters?playerVersion=HTML5)
soundcloudConfig | An object containing configuration for the SoundCloud player. Includes `clientId`, which can be used to override the default `client_id`
vimeoConfig | An object containing configuration for the Vimeo player. Includes `iframeParams`, which maps to the [parameters accepted by the Vimeo iframe player](https://developer.vimeo.com/player/embedding#universal-parameters)
youtubeConfig | An object containing configuration for the YouTube player. Includes `playerVars`, which maps to the [parameters accepted by the YouTube iframe player](https://developers.google.com/youtube/player_parameters?playerVersion=HTML5)
onProgress | Callback containing `played` and `loaded` progress as a fraction eg `{ played: 0.12, loaded: 0.34 }`
onPlay | Called when media starts or resumes playing after pausing or buffering
onPause | Called when media is paused
Expand Down
6 changes: 3 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ export default class App extends Component {
playing={this.state.playing}
volume={this.state.volume}
onProgress={this.onProgress}
soundcloud={this.state.soundcloud}
vimeo={this.state.vimeo}
youtube={this.state.youtube}
soundcloudConfig={this.state.soundcloudConfig}
vimeoConfig={this.state.vimeoConfig}
youtubeConfig={this.state.youtubeConfig}
onPlay={() => console.log('onPlay')}
onPause={() => console.log('onPause')}
onBuffer={() => console.log('onBuffer')}
Expand Down
6 changes: 3 additions & 3 deletions src/players/SoundCloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const MATCH_URL = /^https?:\/\/(soundcloud.com|snd.sc)\/([a-z0-9-]+\/[a-z0-9-]+)
export default class SoundCloud extends Base {
static propTypes = propTypes
static defaultProps = {
soundcloud: {
soundcloudConfig: {
clientId: DEFAULT_CLIENT_ID
}
}
Expand All @@ -35,14 +35,14 @@ export default class SoundCloud extends Base {
if (err) {
reject(err)
} else {
window[SDK_GLOBAL].initialize({ client_id: this.props.soundcloud.clientId })
window[SDK_GLOBAL].initialize({ client_id: this.props.soundcloudConfig.clientId })
resolve(window[SDK_GLOBAL])
}
})
})
}
getSongData (url) {
return fetch(RESOLVE_URL + '?url=' + url + '&client_id=' + this.props.soundcloud.clientId)
return fetch(RESOLVE_URL + '?url=' + url + '&client_id=' + this.props.soundcloudConfig.clientId)
.then(response => response.json())
}
play (url) {
Expand Down
7 changes: 3 additions & 4 deletions src/players/Vimeo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Base from './Base'
const IFRAME_SRC = 'https://player.vimeo.com/video/'
const MATCH_URL = /https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)/
const MATCH_MESSAGE_ORIGIN = /^https?:\/\/player.vimeo.com/
const DEFAULT_IFRAMEPARAMS = {
const DEFAULT_IFRAME_PARAMS = {
api: 1,
autoplay: 1,
badge: 0,
Expand All @@ -19,7 +19,7 @@ const DEFAULT_IFRAMEPARAMS = {
export default class Vimeo extends Base {
static propTypes = propTypes
static defaultProps = {
vimeo: {}
vimeoConfig: {}
}
static canPlay (url) {
return MATCH_URL.test(url)
Expand Down Expand Up @@ -86,8 +86,7 @@ export default class Vimeo extends Base {
width: '100%',
height: '100%'
}
const iframeParams = { ...DEFAULT_IFRAMEPARAMS, ...this.props.vimeo.iframeParams }
console.log('iframeParams',iframeParams,queryString.stringify(iframeParams))
const iframeParams = { ...DEFAULT_IFRAME_PARAMS, ...this.props.vimeoConfig.iframeParams }
return (
<iframe
ref='iframe'
Expand Down
6 changes: 3 additions & 3 deletions src/players/YouTube.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const SDK_URL = '//www.youtube.com/iframe_api'
const SDK_GLOBAL = 'YT'
const MATCH_URL = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/
const PLAYER_ID = 'youtube-player'
const DEFAULT_PLAYERVARS = {
const DEFAULT_PLAYER_VARS = {
autoplay: 1,
controls: 0,
showinfo: 0
Expand All @@ -17,7 +17,7 @@ const DEFAULT_PLAYERVARS = {
export default class YouTube extends Base {
static propTypes = propTypes
static defaultProps = {
youtube: {}
youtubeConfig: {}
}
static canPlay (url) {
return MATCH_URL.test(url)
Expand Down Expand Up @@ -53,7 +53,7 @@ export default class YouTube extends Base {
width: '100%',
height: '100%',
videoId: id,
playerVars: { ...DEFAULT_PLAYERVARS, ...this.props.youtube.playerVars },
playerVars: { ...DEFAULT_PLAYER_VARS, ...this.props.youtubeConfig.playerVars },
events: {
onReady: this.onReady,
onStateChange: this.onStateChange,
Expand Down
6 changes: 3 additions & 3 deletions src/propTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ export default {
volume: PropTypes.number,
width: PropTypes.oneOfType([ PropTypes.string, PropTypes.number ]),
height: PropTypes.oneOfType([ PropTypes.string, PropTypes.number ]),
soundcloud: PropTypes.shape({
soundcloudConfig: PropTypes.shape({
clientId: PropTypes.string
}),
youtube: PropTypes.shape({
youtubeConfig: PropTypes.shape({
playerVars: PropTypes.object
}),
vimeo: PropTypes.shape({
vimeoConfig: PropTypes.shape({
iframeParams: PropTypes.object
}),
onPlay: PropTypes.func,
Expand Down

0 comments on commit 896a20a

Please sign in to comment.