SoundCloud API v3 Stream not working in Chrome
Asked Answered
S

2

6

I have been trying to get this to work for months but it's still not working. It works fine in all browsers except Google Chrome. The problem is audio doesn't stream in Chrome.

Here's a JS fiddle of the most basic example. https://jsfiddle.net/sq23uxqs/

First I include the new javascript SDK

 <script src="https://connect.soundcloud.com/sdk/sdk-3.0.0.js"></script>

Then in my Javascript

 SC.initialize({
            client_id: "78c2f0ffbef212328769a921e5663879"
          });


 SC.stream('/tracks/293').then(function(player){
         player.play();
 });

Does anyone know why this is or is it a problem with the API?

Satiate answered 10/12, 2015 at 13:24 Comment(2)
I also reproduce this on Chrome 47 OSX, working fine on Safari and FF. halp. please.Bisque
Possible duplicate of why doesn't Chrome stream a song using SoundCloud API V3Mitinger
S
1

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.

https://github.com/soundcloud/soundcloud-javascript/issues/39

Satchel answered 1/3, 2016 at 18:43 Comment(0)
E
0

'rtmp' protocol on chrome causes that issue.. reverse the order of available protocols so 'http' will be before 'rtmp'

if (player.options.protocols[0] === 'rtmp') {
    player.options.protocols = player.options.protocols.reverse();
}
Eklund answered 24/3, 2017 at 20:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.