在我的反应应用程序中使用SC.stream,我只是试图从soundcloud API播放一首曲目.这是我的代码:
SC.initialize({
client_id: '12xxx' // my client ID
});
//[...]
console.log(this.props.track.trackId); // I get here successfully the trackId from the song I'd like to play
SC.stream('/tracks/'+this.props.track.trackId, function(track){
track.play();
console.log(track); // I successfully get the track object here. playState attribute is on 1
});
Run Code Online (Sandbox Code Playgroud)
不幸的是,曲目从未开始播放.我在控制台中没有错误.
编辑:问题仅在chrome上,它在firefox和safari上完美运行.我现在更加困惑.
编辑2:它似乎与不在Chrome上运行的HTML5播放器相关联:当您在chrome:// plugins /重新启用Flash播放器时,通过选中"始终允许运行",它可以正常工作