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

Player doesn't work in Chrome #39

Closed
sammorrisdesign-zz opened this issue Jan 31, 2016 · 37 comments

Comments

@sammorrisdesign-zz
Copy link

commented Jan 31, 2016

I've been having issues with getting Soundcloud to play correctly in Chrome. It used to work perfectly but has recently broke, but only in Chrome. It works fine in any other browser.

I'm using v1 of the SDK, so it still has the SoundManager player. However, quick tests with the latest version of the SDK give me the same results. So while I'm planning to upgrade to the latest SDK as soon as possible that doesn't fix the issue.

I seem to be able to get around the issue by moving #sm2-container within view, and pressing play on the now visible flash player...

screen shot 2016-01-31 at 16 41 54

Then everything works as it previously did. Any ideas?

Edit – I've just put the following into a standalone document to the same results. Works in Safari, Firefox, etc... but doesn't in Chrome.

<script src="https://connect.soundcloud.com/sdk/sdk-3.0.0.js"></script>
<script>
  SC.initialize({
    client_id: '5dcb5ea7cb935713b230330006d1765e'
  });
  SC.stream('/tracks/293').then(function(player){
  player.play();
});
</script>
@Martin1982

This comment has been minimized.

Copy link

commented Feb 2, 2016

I'm using the 1.1.x SDK as well, and I experience the same issues. When opening a page where the SDK is initialized I try the following;

load SDK 3.0 -> Start a basic stream via the Javascript console:
SC.stream('/tracks/293').then(function(player){ player.play(); });
-> All ok, audio is playing

load SDK 1.1.5 -> Start a basic stream via the Javascript console:
SC.stream('/tracks/293', function(sound) { sound.start(); });
-> No sound

Could you confirm this?

@samjosephmark

This comment has been minimized.

Copy link

commented Feb 5, 2016

Yes I'm seeing this as well for any track that attempts to play using RTMP. The SDK checks that flash is available and uses the RTMP stream, it begins to buffer and then won't play.

@tbachir

This comment has been minimized.

Copy link

commented Feb 7, 2016

Any news about this bug? Any solutions? Got the same on my website, didn't found any fix... http://www.dealerdemusique.com/, works fine on any other browser.

@AlexSleepy

This comment has been minimized.

Copy link

commented Feb 9, 2016

Same here. No errors in console, network tab shows that track is downloaded, but no sound. My script used to work in chrome v 47, and stopped working in 48.
Any news how to fix it?

@vladmustiata

This comment has been minimized.

Copy link

commented Feb 9, 2016

Same problem here. We're using the old version of the SDK and the player doesn't make any sound, even if it's loading and all seems to work fine...

@vladmustiata

This comment has been minimized.

Copy link

commented Feb 15, 2016

Any news guys? Our websites are broken still. 👎

@jstallworth

This comment has been minimized.

Copy link

commented Feb 21, 2016

Hi guys, I don't think soundcloud's ever going to fix this issue since they no longer support sdk versions prior to 3.0. I fixed it by including the latest soundmanager2 library in my application, and loading it using $.getScript in my main js file, giving me a global, already initialized HTML5-only version of the soundManager, so my songs play on chrome now.

@paulcarvill

This comment has been minimized.

Copy link

commented Feb 21, 2016

There's some more detail on this issue on Stack Overflow

After investigation it seems to be related to issues with the flash player. Proof is that if you go here chrome://plugins/ and disactivate the flash player it will work again in Chrome. But obviously when developing a site you don't want the site to work just for you.

Soundcloud Api seems to use soundmanager2 as a base to handle audio stream that itself have 2 modes flash and html5. The issue is that if the flash player is avaible it will try to use it and fail while if it's not available it will just use html5 and work right away.

@davidmoret

This comment has been minimized.

Copy link

commented Feb 24, 2016

Hi,
Someone was able to force Chrome to render the player in HTML5 ? (I tried the solution jstallworth without success). Anyone know why the player widget hasn't this problem ?
It's shame, chrome is so popular..

@ArthurRougier

This comment has been minimized.

Copy link

commented Feb 27, 2016

Same here... @jstallworth, could you detail your solution ? You seem to be the only one having found a workaround

@jstallworth

This comment has been minimized.

Copy link

commented Feb 27, 2016

Ok here's how I solved it. From testing in the console I found that within SC.stream() a new soundManager object was created. Typing soundManager.version into the console, I could see that it was an older version that defaults to flash, thus the problem in Chrome. From there, I figured I would have to download the newer soundManager since it would certainly default to html5 (iOS doesn't have flash). Here are the steps I took:

  1. Downloaded an up to date soundManager2 from http://www.schillmania.com/projects/soundmanager2/doc/download/
  2. Uploaded the folder to my static web directory
  3. I'm using jQuery, so I just loaded the soundManager js into my javascript document using $.getScript(url), but I'm sure these instructions will be helpful if you're not using jQuery: http://www.schillmania.com/projects/soundmanager2/doc/getstarted/
  4. The soundManager object from that script works in Chrome, and while I'm not sure exactly why the soundManager created in SC.stream() doesn't override it, it's easy to imagine implementations of SC.stream() that would work that way.

Let me know if this doesn't work for you/isn't clear

@smarchal

This comment has been minimized.

Copy link

commented Feb 27, 2016

@jstallworth this fixed it for me too, no other changes needed in my code (e.g. http://soundgram.co).

Thanks a million.

@AlexSleepy

This comment has been minimized.

Copy link

commented Feb 29, 2016

I've tried this. Doesn't work for me :( I've tried adding script as $.getScript("js/sm2/script/soundmanager2.js"); but this doesn't help, seems like SC overrides this in my case.
I think it's time to start rewriting my script using SDK v3

@davidmoret

This comment has been minimized.

Copy link

commented Mar 1, 2016

It doesn't fixed it for me.. the soundManager object is replaced when I call SC.stream..
@smarchal your soundgram app works fine on my firefox but not on my chrome. I'm on OSX Yossemite..

@Mannaio

This comment has been minimized.

Copy link

commented Mar 1, 2016

@jstallworth Thanks for finding out the issue, my application is using the same api from this ember application https://github.com/lrdiv/ember-soundcloud and i am having exactly the same problem in chrome, deactivating the flash it works fine, now i have to figure it out how to refactor it with soundManager2. Any help is appreciate

@loudmouth

This comment has been minimized.

Copy link

commented Apr 7, 2016

I was able to get audio to playback on Chrome, Safari, and Firefox thanks to the solution provided by @jstallworth and a peek a @smarchal's site. However, I could only get this working using a souncloud sdk lacking a version number <script type="text/javascript" src="https://connect.soundcloud.com/sdk.js">as opposed to src="https://connect.soundcloud.com/sdk/sdk-3.0.0.js".

I'm now trying to get things working with v3.0.0 of the SDK which uses Promises and my best guess at this point is that using soundmanager, i need to load the resource returned from SC.get request into soundmanager and wait to buffer before playing. I have not been able to figure out how to do this so far. Otherwise I get a 404. If anybody has some example code on how to get soundmanager and soundcloud3 working on Chrome i would be forever grateful.

@loudmouth

This comment has been minimized.

Copy link

commented Apr 7, 2016

I figured out how to get SoundManager2 to work with the SoundCloud Javascript sdk v3.0.0 on Chrome, Safari, Firefox and thought the code might be helpful so here it is. (This assumes you called the soundmanager.setup method of when the dom was made ready).

soundmanager will get the audio file from soundcloud so you need to pass in soundcloud client id

// get track(s) at the relevant soundcloud api route
SC.get('/users/711016/tracks').then(function(tracks) {
    // make the relevant soundmanager sound object
    var sound = soundManager.createSound({
        id: 'mySound',
        url: tracks[0].stream_url + "?client_id=YOUR_CLIENT_ID",
        stream: true
    });
    sound.play();
});
@visualex

This comment has been minimized.

Copy link

commented Apr 9, 2016

Hey all,
I didn't want to use the SC sdk + the soundmanager,
so I made a simple adjustment to the SC sdk js file,
detecting chrome, and returning false here:
line 5139 here:
http://dvoinoi.com/js/sc3.js

works in firefox, chrome, safari

@Mannaio

This comment has been minimized.

Copy link

commented Apr 17, 2016

@visualex This is nice temporary hack :), i want to do the same for my app, and this is my sdk.js, in which line should i do the same chrome detection to disable flash audio stream mode? Many thanks
sdk.txt

@Mannaio

This comment has been minimized.

Copy link

commented Apr 24, 2016

i had to add soundManager.preferFlash = false to line 1928

@ohgreatapollo

This comment has been minimized.

Copy link

commented Apr 27, 2016

I'm having the same issue and implementing either of these fixes does not resolve the issue. Using @jstallworth fix the player will play the song once then it will not allow us to play it again. and using the new sdk it breaks our waveforms and our play/pause features so that's not applicable.

Note: this only works on the actual product pages, the custom soundcloud still works on the main site on all browsers

http://www.adsrsounds.com

@shaibam

This comment has been minimized.

Copy link

commented May 15, 2016

I did this:
instead of using SC.stream(), I've created an html audio element and set it's source to the track's "stream_url" property with "?client_id=MY_CLIENT_ID".

*** long tracks which use hls, will need an additional hls playback support.

@tttt-conan

This comment has been minimized.

Copy link

commented Jul 14, 2016

I've just found out a simple workaround for this issue. Checking the player returned by the sc.stream(), in the options property, I found a property called protocols, which is an array like this ['rtmp', 'http'], that 'rtmp' is the problem. So I try remove the protocols 'rtmp' before running player.play() and it actually worked.

@MchlG

This comment has been minimized.

Copy link

commented Jul 27, 2016

@tttt-conan your work around works well for me thank you. Do you have any idea why it wont work on my iPhone's safari browser?

@aydamacink

This comment has been minimized.

Copy link

commented Aug 8, 2016

@tttt-conan: Do you have a code example where you added the protocols option? Thx in advance

@tttt-conan

This comment has been minimized.

Copy link

commented Aug 8, 2016

@aydamacink I just remove the protocols like this

SC.stream(song.streamURL).then(function(scPlayer) {
    if (scPlayer.options.protocols[0] === 'rtmp') {
        scPlayer.options.protocols.splice(0, 1);
    }
    scPlayer.play();
}

https://en.wikipedia.org/wiki/Real-Time_Messaging_Protocol
You can see in the link above, this protocol tells the browser (Chrome only) to use flash player to stream, which caused the problem, you can see the guys explain above, so by removing this protocol, 'http' is what left in the array, so the browser will now use HTML5 instead

@adi518

This comment has been minimized.

Copy link

commented Sep 4, 2016

Salvation. After hours of frustration and inconsistent documentation.

Used @tttt-conan solution. Don't seem to need Soundmanager 2. :)

@rycharlind

This comment has been minimized.

Copy link

commented Sep 14, 2016

I just used @tttt-conan solution as well. Worked for me!

@jamiegalbreath

This comment has been minimized.

Copy link

commented Dec 19, 2016

@tttt-conan WORKS!

@alimony

This comment has been minimized.

Copy link

commented Dec 22, 2016

I chose to reverse the protocols array instead, i.e. scPlayer.options.protocols = ['http', 'rtmp'] which works fine as well, and should provide Flash fallback for browsers that do not support HTML5 audio.

@adi518

This comment has been minimized.

Copy link

commented Dec 23, 2016

@alimony actually, that is the correct solution. Everyone just forgot about Flash. Although, I didn't add old browser support in my project, so it didn't occur to me.

@chemic

This comment has been minimized.

Copy link

commented Mar 24, 2017

@tttt-conan thx for your hint.. awesome! Ended up not removing the rtmp protocol.. but reversed the order if it was 1st element of the array.

if (player.options.protocols[0] === 'rtmp') {
    player.options.protocols = player.options.protocols.reverse();
}
@ghost

This comment has been minimized.

Copy link

commented Jul 22, 2018

In many cases, problems like these will turn out to be caused by some amateurish Chrome extension which has never been thoroughly tested. In my case, the problem of soundcloud files not playing was solved from the very moment that I disabled (and then removed) my "Disable HTML5 Autoplay" - a plugin which was a prime suspect of course, as it was made to prevent something from playing (automatically).

@VasudevAkhil

This comment has been minimized.

Copy link

commented Dec 5, 2018

Hi @tttt-conan
I am using version 3.3.1 of the sdk.
There is no options key now in player object. Any idea how to change protocol for this version of sdk
My chrome version is 71

@tjenkinson

This comment has been minimized.

Copy link
Contributor

commented Dec 5, 2018

Hey @VasudevAkhil the player should choose the best protocol automatically that is supported internally. Why do you need to change it?

@tttt-conan

This comment has been minimized.

Copy link

commented Dec 10, 2018

Hi @VasudevAkhil , I haven't checked it yet but even with SDK version 3.3.1 and Chrome 71 this issue is still persist?

@tjenkinson

This comment has been minimized.

Copy link
Contributor

commented Dec 10, 2018

I am going to close this issue, because I believe the initial problem mentioned here was fixed a while ago. Please open a new issue if something is still not working properly, and we can discuss it there.

Thanks!

@tjenkinson tjenkinson closed this Dec 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.