Created
December 27, 2017 12:47
-
-
Save drFabio/9099d0105b6a9d2c15ad88b249a83988 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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