SoundCloud + Soundmanager2 + EQData [英] SoundCloud + Soundmanager2 + EQData

查看:289
本文介绍了SoundCloud + Soundmanager2 + EQData的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这与该问题基本相同,但有更多详细信息:

Soundcloud + SoundManager错误:读取流的eqData

因此,我有一个使用canvas/svg/的可视化程序,当您从SoundCloud/SoundManager2接收EQData时,它看起来很棒,但是发生了一些非常奇怪的事件,导致它不那么酷.

1.)当您使用SMSound.pause()或任何变体(SoundManager.togglePause等),然后恢复所有EQData/WaveformData时,停止进入SoundManager2且仅归零.

2.)如果停止轨道并重新启动它,则所有EQData/WaveformData都会停止.

3.)有时候,在没有警告的情况下,EQData/WaveformData只是停止进入SM2,而可视化器也只是停止,如果我转到下一首曲目,它会再次启动,但是在30秒内它从未达到100%的效果.

我无法弄清楚这是SoundCloud还是SoundManager2问题,但似乎其他人也遇到了问题,但直到现在我仍无法在任何地方找到任何解决方案.

可在此处找到链接: http://nikru.com/viz/.它被从站点中删除,因为它是针对客户尚未启动但尚未公开的客户的站点. :)

任何帮助都将受到感激.

谢谢!

解决方案

好的.我敢肯定其他人也遇到过这种情况,并且没有快速解决方案.我希望这对其他人有帮助,因为我已经花了大约一天的时间来尝试各种可能性,并认为我为每个人提供了一种解决方法.

发生的情况是,当SoundManager2首次从 http ://api.soundcloud.com/tracks/9708215/stream?consumer_key = {您的密钥}页面.很棒,歌曲可以播放,因为api.soundcloud.com具有crossdomain.xml文件.不过令人讨厌的是,下一个请求(暂停/播放或下一首/上一首曲目)上的SoundManager2只是返回到它所知道的内容(这是ec-media.soundcloud.com上的301页,正如我在ec- media.soundcloud.com没有crossdomain.xml文件),这不是很好.我的解决方法是每次重新播放歌曲时,都会修改声音的URL,使其包含新的ts = {time}参数,然后在SMSound上运行.load(),从而导致重新加载并解决此问题.

var $track = $(this),
    data = $track.data('track'),
    playing = $track.is('.active');
newURL  = soundManager.sounds["track_" + data.id].url.split("&ts=")[0];
newURL += "&ts=" + Math.round((new Date()).getTime() / 1000);
soundManager.sounds["track_" + data.id].url = newURL;
soundManager.sounds["track_" + data.id].load();
soundManager.sounds["track_" + data.id].url = newURL;

然后,为了节省歌曲暂停时的带宽,我实际上只是将其静音并保存了歌曲暂停的位置.当他们取消暂停时,我会在他们离开并取消静音的位置播放那首曲目.这虽然不漂亮,但是这是我们拥有的一切(我认为)所能做到的最好的方法.

希望这对某人有帮助. :)

This is essentially the same as this question but with more detail:

Soundcloud + SoundManager bug: reading a stream's eqData

So I have a visualizer using canvas / svg / what have you which looks GREAT when it is receiving EQData from SoundCloud / SoundManager2 but there are some very strange events that are happening which cause it to not be as cool.

1.) When you use SMSound.pause() or any variation (SoundManager.togglePause, etc) and then resume all EQData / WaveformData stops coming to SoundManager2 and it just zeros out.

2.) If you stop a track and restart it, all the EQData / WaveformData stops.

3.) Occasionally and without warning the EQData / WaveformData just stops coming to SM2 and the visualizer just stops, if I go to the next track it starts up again but it never has worked 100% for a song over 30 seconds.

I've not been able to figure out whether this is a SoundCloud or SoundManager2 issue but it seems that some other people have had problems but until now I've been unable to find any solution anywhere.

Link is available here: http://nikru.com/viz/. It is stripped out of the site because it is for a client's unlaunched site which they don't want the public to see yet. :)

Any help is HUGELY appreciated.

Thanks!

解决方案

Okay. I'm sure other people have encountered this and not had a quick fix. I hope this helps someone else as I've been playing with possibilities for a day or so and think I have a workaround for everyone.

What happens is that when SoundManager2 calls the song the first time it requests from the http://api.soundcloud.com/tracks/9708215/stream?consumer_key={YOUR KEY} page. This is great and the song can play just find as api.soundcloud.com has a crossdomain.xml file. What sucks though is that SoundManager2 on the next request (pause / play or next / previous track) just goes back to what it knows (which is a 301'd page at ec-media.soundcloud.com and as I mentioned before ec-media.soundcloud.com has no crossdomain.xml file) this is not great. My fix is every time I start a song over again I modify the Sound's URL to include a new ts={time} argument and then run .load() on the SMSound which causes a reload and fixes the issue.

var $track = $(this),
    data = $track.data('track'),
    playing = $track.is('.active');
newURL  = soundManager.sounds["track_" + data.id].url.split("&ts=")[0];
newURL += "&ts=" + Math.round((new Date()).getTime() / 1000);
soundManager.sounds["track_" + data.id].url = newURL;
soundManager.sounds["track_" + data.id].load();
soundManager.sounds["track_" + data.id].url = newURL;

And then as to save on bandwidth when the song is paused I actually just mute it and save the position the song was paused at. When they unpause I play that track at the position they left off and unmute... It's not pretty but it is the best we can do with what we have (I think).

Hope this helps someone. :)

这篇关于SoundCloud + Soundmanager2 + EQData的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆