Skip to content

Instantly share code, notes, and snippets.

@drFabio
Created December 27, 2017 12:47
Show Gist options
  • Save drFabio/9099d0105b6a9d2c15ad88b249a83988 to your computer and use it in GitHub Desktop.
Save drFabio/9099d0105b6a9d2c15ad88b249a83988 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
export class BgMusic extends Component {
render() {
if (this.props.mute) {
return null
}
if (this.props.gameOver) {
return (
<audio
key={'gameOver'}
autoPlay
loop
>
<source type={'audio/mp3'}
src={'https://pergunteaodev.nyc3.digitaloceanspaces.com/Nevermore.mp3'} />
</audio>
)
}
if (this.props.running) {
return (
<audio
key={'running'}
autoPlay
loop
>
<source type={'audio/mp3'}
src={'https://pergunteaodev.nyc3.digitaloceanspaces.com/Surreptitious.mp3'} />
</audio>
)
}
return (
<audio
key={'title'}
autoPlay
loop
>
<source type={'audio/mp3'}
src={'https://pergunteaodev.nyc3.digitaloceanspaces.com/Destiny.mp3'} />
</audio>
)
}
}
export default BgMusic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment