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 · 38 comments
Closed

Player doesn't work in Chrome #39

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

Comments

@sammorrisdesign-zz
Copy link

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
Copy link

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
Copy link

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
Copy link

tbachir 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
Copy link

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?

@mustvlad
Copy link

mustvlad 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...

@mustvlad
Copy link

Any news guys? Our websites are broken still. 👎

@jstallworth
Copy link

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.

@ghost
Copy link

ghost 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
Copy link

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
Copy link

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

@jstallworth
Copy link

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
Copy link

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

Thanks a million.

@AlexSleepy
Copy link

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
Copy link

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
Copy link

Mannaio 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
Copy link

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
Copy link

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
Copy link

visualex 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
Copy link

Mannaio 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
Copy link

Mannaio commented Apr 24, 2016

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

@ohgreatapollo
Copy link

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
Copy link

shaibam 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
Copy link

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
Copy link

MchlG 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
Copy link

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

@tttt-conan
Copy link

@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
Copy link

adi518 commented Sep 4, 2016

Salvation. After hours of frustration and inconsistent documentation.

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

@rycharlind
Copy link

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

@jamiegalbreath
Copy link

@tttt-conan WORKS!

@alimony
Copy link

alimony 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
Copy link

adi518 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
Copy link

chemic 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
Copy link

ghost 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).

@ghost
Copy link

ghost 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
Copy link
Contributor

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

@tttt-conan
Copy link

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
Copy link
Contributor

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!

@prospot99
Copy link

The player is working at https://www.producerspot.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests