Skip to content

Soundcloud implementation with SC.stream to avoid focus problems - #262

Closed
SkinyMonkey wants to merge 2 commits into
cookpete:masterfrom
SkinyMonkey:feature-SC.stream
Closed

Soundcloud implementation with SC.stream to avoid focus problems#262
SkinyMonkey wants to merge 2 commits into
cookpete:masterfrom
SkinyMonkey:feature-SC.stream

Conversation

@SkinyMonkey

Copy link
Copy Markdown
Contributor

might not be perfect but it's a start.
difference with the previous soundcloud implementation:

  • Use of the SC.stream instead of the iframe
  • Use of SC.get to retrieve the id of the track
  • A this.state was added to rerender the component and image with setState when the artwork is loaded
  • a pSetState was added to wrap setState into a promise
  • Errors are defined by multiple events by the soundcloud event emitter
  • The data is extracted from a subobject of the player : _controller
  • The volume does not need to be divided

SDK choice :
https://connect.soundcloud.com/sdk.js is an old 2.0 version, no promises
https://connect.soundcloud.com/sdk/sdk-3.2.2.js asks for a secret_token
3.0.0 was kept

BUG FOUND:
bug found at src/Player.js : this.onPause is not given as a parameter to the active Player:
When i paused my player i could not play it back.
i noticed that the internal isPlaying variable wasn't updated.
Ultimately it was the onPause callback that wasn't passed back to
the Player in the render function.
Adding it fixed my problem

@cookpete

Copy link
Copy Markdown
Owner

What is the benefit of using the streaming SDK over the iframe widget? The title of the PR mentions "focus problems" but you haven't specified exactly what problems there are.

The library has already switched from using the SDK to the widget in the past because of issues with the client ID and rate limiting, along with the fact that signing up for your own client ID is currently unavailable.

@SkinyMonkey

SkinyMonkey commented Oct 30, 2017 via email

Copy link
Copy Markdown
Contributor Author

@cookpete

Copy link
Copy Markdown
Owner

When I play a track and the next one does not use the same provider, for
example from youtube to soundcloud, if the window is not focused at the
moment the track won't play.

Ah this is exactly what the preload config does for youtube, vimeo and dailymotion. I'll see if the same logic can be applied to the Soundcloud player.

@cookpete cookpete closed this Oct 30, 2017
@SkinyMonkey

SkinyMonkey commented Oct 30, 2017 via email

Copy link
Copy Markdown
Contributor Author

cookpete added a commit that referenced this pull request Oct 30, 2017
@cookpete

Copy link
Copy Markdown
Owner

By the way : should i open an issue for the bug i found?

No need: fixed and published in 1.0.0-beta.2, including preload support for Soundcloud.

devhub324 pushed a commit to devhub324/React_VideoPlayer that referenced this pull request Dec 23, 2018
devhub324 pushed a commit to devhub324/React_VideoPlayer that referenced this pull request May 23, 2020
albanqoku added a commit to albanqoku/react-player that referenced this pull request Feb 24, 2021
Webmaster1116 added a commit to Webmaster1116/video-player that referenced this pull request May 20, 2021
webmiraclepro added a commit to webmiraclepro/video-player that referenced this pull request Sep 9, 2022
philip-luther added a commit to philip-luther/react-player that referenced this pull request Nov 22, 2024
startechguru added a commit to startechguru/react-codetutor that referenced this pull request Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants