Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added autoPlay prop for streamUrl #70

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ _(String)_ - this could be regular link from SoundCloud web app which points to
// playlist
"https://soundcloud.com/stepan-i-meduza-official/sets/dolgo-obyasnyat-ep"
```
##### `autoPlay`

_(boolean)_ - if set to `true` using `streamUrl` will autoplay track when buffered.

##### `onReady`

Expand Down
1 change: 1 addition & 0 deletions src/addons/SoundPlayerContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ SoundPlayerContainer.propTypes = {
onStopTrack: PropTypes.func,
onPauseTrack: PropTypes.func,
onVolumeChange: PropTypes.func,
autoPlay: PropTypes.bool,
onReady: PropTypes.func
};

Expand Down
7 changes: 7 additions & 0 deletions src/addons/withSoundCloudAudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ export default function withSoundCloudAudio (WrappedComponent) {
soundCloudAudio.on('pause', ::this.onAudioPaused);
soundCloudAudio.on('ended', ::this.onAudioEnded);
soundCloudAudio.on('volumechange', ::this.onVolumeChange);
if (this.props.autoPlay) {
soundCloudAudio.on('canplay', ::this.autoPlay);
}
}

autoPlay() {
this.soundCloudAudio.play();
}

onSeekingTrack() {
Expand Down
1 change: 0 additions & 1 deletion styles/buttons.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
border: 0;
outline: none;
cursor: pointer;
-webkit-transition: box-shadow, .05s ease, -webkit-transform;
transition: box-shadow, .05s ease, -webkit-transform;
transition: transform, box-shadow, .05s ease;
transition: transform, box-shadow, .05s ease, -webkit-transform;
Expand Down
5 changes: 2 additions & 3 deletions styles/cover.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
}
.sb-soundplayer-cover:after {
content: '';
background: -webkit-linear-gradient(rgba(0,0,0,.05), rgba(0,0,0,.35));
background: linear-gradient(rgba(0,0,0,.05), rgba(0,0,0,.35));
background: linear-gradient(rgba(0, 0, 0, .05), rgba(0, 0, 0, .35));
position: absolute;
z-index: 1;
width: 100%;
Expand All @@ -40,7 +39,7 @@
font-size: 18px;
}
.sb-soundplayer-cover-logo {
color: rgba(255,255,255,.9);
color: rgba(255, 255, 255, .9);
width: 100px;
height: 14px;
position: absolute;
Expand Down
1 change: 0 additions & 1 deletion styles/progress.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
.sb-soundplayer-progress-inner {
background-color: #FC561E;
height: 100%;
-webkit-transition: width .2s ease-in;
transition: width .2s ease-in;
}
1 change: 0 additions & 1 deletion styles/volume.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
.sb-soundplayer-volume div {
overflow: hidden;
width:0;
-webkit-transition: width .2s ease-out;
transition: width .2s ease-out;
position: relative;
}
Expand Down