SoundCloud API:audiomanager.js上的setVolume [英] SoundCloud API: setVolume on audiomanager.js

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

问题描述

在使用SoundCloud Javascript API时,setVolume函数一直存在问题.

We've been having problems with the setVolume function while using the SoundCloud Javascript API.

跟踪:

未捕获的IndexSizeError:索引或大小为负,或大于允许的值. audiomanager.js:2 HTML5AudioPlayer.setVolume

Uncaught IndexSizeError: Index or size was negative, or greater than the allowed value. audiomanager.js:2 HTML5AudioPlayer.setVolume

和往常一样,我们在声音对象上调用该函数,我们传递给的值在0到100之间,这是指定为正确的值.

We are calling that function on the sound object, as usual, and the values we're passing to are between 0 and 100, which are the ones that are specified as correct.

问题是在几个小时前开始的,我们没有对代码进行任何更改,因此似乎我们从soundcloud检索的audiomanager的版本今天已经更改.

The problem started a few hours ago and we haven't made any changes in our code, so it seems that the version of audiomanager we're retrieving from soundcloud has changed today.

有什么主意吗?

谢谢

推荐答案

SoundCloud JavaScript SDK似乎在一夜之间发生了变化.我正面临类似的问题. SDK现在正在使用HTML5AudioPlayer对象来流跟踪.关于您的问题,我注意到音量值必须在0到1之间,而在旧"版本中是0到100.因此,请确保调用sound.setVolume(0.5)而不是sound.setVolume(50).此外,边玩边玩"事件不再触发.

It seems like the SoundCloud JavaScript SDK has changed over night. I'm facing similar issues. The SDK is using the HTML5AudioPlayer object now to stream tracks. As for you question, I've noticed that the volume value needs to be between 0 and 1 opposed to 0 and 100 in the "old" version. So be sure to call sound.setVolume(0.5) instead of sound.setVolume(50). Also, the "whileplaying" event is not firing anymore.

SoundCloud很高兴在将来更新他们的文档/通知开发人员有关SDK的更改.同时,我正在查看 https://connect.soundcloud.com/audiomanager/audiomanager .js 查找我的问题的答案.

It would be nice of SoundCloud to update their docs / inform devs about SDK changes in the future. In the mean time, I'm looking at https://connect.soundcloud.com/audiomanager/audiomanager.js to find answers to my questions.

这篇关于SoundCloud API:audiomanager.js上的setVolume的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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