Marcos Aguayo
Marcos Aguayo

Reputation: 7170

Soundcloud player without flash

Hi I'm trying to customize an audio player using soundcloud API. https://github.com/soundcloud/soundcloud-custom-player/wiki

This is my code:

<!DOCTYPE html>
<html>
<head>
    <title>Reproductor</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <link rel="stylesheet" href="soundcloud/css/sc-player-minimal.css" type="text/css">
</head>
<body>

    <a href="http://soundcloud.com/dark-pointer/dark-pointer-disconnect-no" class="sc-player">Test</a>

    <script type="text/javascript" src="soundcloud/js/soundcloud.player.api.js"></script>
    <script type="text/javascript" src="soundcloud/js/sc-player.js"></script>
</body>
</html>

Only works on Chrome. I think it's because of that I have no flash in firefox. But should play in HTML5 if I have not flash

Does anyone know how to play it with html5?

You can see my tests here: http://jreedon.marcosaguayo.com/

I have tried the examples and not working http://jreedon.marcosaguayo.com/soundcloud/examples/sc-player-red.html

Upvotes: 0

Views: 1784

Answers (2)

hafid
hafid

Reputation: 11

Hello my english is very bad but i can give you an answer for you problem because I got the same today and i found a solution pretty ugly but his works. First you must to update flash player on firefox because it doesn't use the audio of html without this the script doesn't work on firefox. And if you want to make a playlist I replace the function api_load with empty function to load a new song.

load: function(track) {
          var url = track.uri;
          if(player){
            $('.sc-player-engine-container').empty();
            $('.sc-player-engine-container').append(flashHtml(url));
          }else{
            // create a container for the flash engine (IE needs this to operate properly)
            $('<div class="sc-player-engine-container"></div>').appendTo(document.body).html(flashHtml(url));
          }
        },

I can say if this is the good solution because I'm novice on Js and in the web technology also. See that on my website http://mifatracks.com/

Upvotes: 1

idbehold
idbehold

Reputation: 17168

SoundCloud uses SoundManager2 to play audio. SoundManager2 will attempt to use native HTML5 audio if the browser can play the mimetype. Firefox 21 just added MPEG support (mpeg/mp3/mp4/m4a) for Windows 7 and above. Vista support is due for Firefox 22 and they are also working to possibly add support for XP eventually.

The Linux and Mac versions of Firefox currently do not support MPEG decoding, but they are working hard to do so. The Linux version will likely get support sooner than Mac.

If you are not running Windows 7+ or do not have Firefox 21 installed, then SoundManager2 will see that your browser is unable to play MPEG natively and will automatically fallback to playing the audio with Flash.

Upvotes: 1

Related Questions