【问题标题】:Controlling Soundcloud HTML5 Widget Player with custom buttons使用自定义按钮控制 Soundcloud HTML5 Widget Player
【发布时间】:2012-07-13 23:50:57
【问题描述】:

我想做一些类似于我在 SoundClouds HTML5 Widget API PLayground 页面上看到的事情,他们有控制播放器的外部按钮: http://w.soundcloud.com/player/api_playground.html

最终我将隐藏播放器小部件本身并将这些按钮用作音乐控制器。

任何建议或提示都会很棒,我在这里发布:http://jsfiddle.net/alexsethalex/qcKed/1/

【问题讨论】:

  • 你真的有什么问题吗?按照 Widget API 页面上的说明操作应该没问题。
  • 嘿,是的,我非常困惑 - 我以为我密切关注它,当我尝试使用按钮时没有任何反应。我检查了我的检查器,看起来我的按钮没有触发任何事件。

标签: javascript custom-controls soundcloud


【解决方案1】:

您查看过Widget API documentation 吗?

这是一个超级简单的例子:

<!doctype html>
<html>
<head>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  <script src="http://w.soundcloud.com/player/api.js"></script>
  <script>
   $(document).ready(function() {
     var widget = SC.Widget(document.getElementById('soundcloud_widget'));
     widget.bind(SC.Widget.Events.READY, function() {
       console.log('Ready...');
     });
     $('button').click(function() {
       widget.toggle();
     });
   });
  </script>
</head>
<body>
  <iframe id="soundcloud_widget"
      src="http://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/39804767&show_artwork=false&liking=false&sharing=false&auto_play=true"
      width="420"
      height="120"
      frameborder="no"></iframe>
  <button>Play / Pause</button>
</body>
</html>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-09-22
    • 2012-05-15
    • 1970-01-01
    • 2011-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多