【发布时间】:2013-08-20 07:12:59
【问题描述】:
我成功使用了 Soundcloud 的小部件 API,除了 setVolume() 方法坏了:(
首先,我喜欢这个小部件,但我惊呆了,毕竟做了这么棒的工作,却没有可用的音量控制!当人们听到 100% 的音频并且我无法使用 setVolume() 更改它时,他们会立即“返回按钮”离开我的网站...我必须让它工作或拉动它:(
这是正在发生的事情,我有一个名为“widget”的实例(它在页面上加载和播放良好)。
widget.bind(SC.Widget.Events.READY, function() {
$('#audioIndictments').removeClass('remove'); // This disables a CSS rule, making the soundCloud iframe visible
widget.setVolume(10); // This should set the volume to 10% but doesn't :(
widget.getVolume(function(vol){
console.log(vol); // This outputs 0.1 in the console :/
console.log(widget); // This outputs the object in the console and I don't see anything out of whack :|
});
widget.play(); // This successfully fires up the widget and the audio begins playing :)
widget.setVolume(10); // Just to see if it makes a difference, after the play() method, I ran setVolume again after the play() method and still no change :(
widget.getVolume(function(vol){
console.log(vol); // This still outputs 0.1 in the console :/
});
});
奇怪的结果。我找到了另一个博主,他问了一个类似的问题,但没有得到满意的答案。这是怎么回事?我没看到什么?
感谢您抽出宝贵时间:)
【问题讨论】:
-
有同样的问题。最重要的是,它有时会返回从 0 到 100 或 0 到 1 的音量 :) John M 解决方案有点工作。
标签: api methods widget soundcloud