Eri*_*ipp 5 html5 volume html5-audio soundcloud web-widget
我一直在尝试使用此Soundcloud博客页面上给出的示例,因此我可以将音量设置得更低. http://developers.soundcloud.com/blog/html5-widget-api
我只更改了iframe大小和src =到我的播放列表,并将set.Volume更改为10所以我可以注意到它的区别是否有效.到目前为止,没有变化量仍然是100%
我已经尝试过,无需在模板的头部放置以下内容.似乎并不重要.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
Run Code Online (Sandbox Code Playgroud)
这是我从Soundcloud示例中调整的代码:
<iframe id="sc-widget" width="350" height="332" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F1417174&auto_play=true&show_artwork=false&color=37415f"></iframe>
<script src="http://w.soundcloud.com/player/api.js" type="text/javascript"></script>
<script type="text/javascript">
(function(){
var widgetIframe = document.getElementById('sc-widget'),
widget = SC.Widget(widgetIframe);
widget.bind(SC.Widget.Events.READY, function() {
widget.bind(SC.Widget.Events.PLAY, function() {
// get information about currently playing sound
widget.getCurrentSound(function(currentSound) {
console.log('sound ' + currentSound.get('') + 'began to play');
});
});
// get current level of volume
widget.getVolume(function(volume) {
console.log('current volume value is ' + volume);
});
// set new volume level
widget.setVolume(10);
});
}());
</script>
Run Code Online (Sandbox Code Playgroud)
这是代码生效的Joomla站点. http://mediaservicesnyc.com/
有人可以帮我理解我缺乏控制音量的东西.
这是一场jquery冲突吗?如果是这样,有关如何解决它的任何想法?
艾瑞克,真诚的
小智 5
卷范围实际上是从0到1,这在文档中说错了.因此,如果您想将音量设置为10%,则需要:
var widgetIframe = document.getElementById('sc-widget'),
widget = SC.Widget(widgetIframe);
widget.setVolume(0.1);
Run Code Online (Sandbox Code Playgroud)