How to use Soundcloud api to get stream into html5 audio player?

后端 未结 2 1206
孤街浪徒
孤街浪徒 2021-02-02 04:11

I\'ve just started learning javascript and as my first attempt I\'d like to create custom audio player which uses soundcloud\'s api as a source for music.

So far this is

2条回答
  •  终归单人心
    2021-02-02 04:38

    Ok, got it figured out. The problem was the .stream() - it's meant to deliver a prepackaged player, deployed by the .play() function.

    If you use SC.get() instead, you'll actually access the properties of the track, and be able to embed it in an audio tag. See my code: http://jsfiddle.net/LpzpK/6/

    There's still a problem - the tracks are marked as 401 forbidden, so the player is only ever "Loading". You'll have to find a way to make the tracks you want to play public.

提交回复
热议问题