使用自定义按钮控制Soundcloud HTML5 Widget Player [英] Controlling Soundcloud HTML5 Widget Player with custom buttons

查看:97
本文介绍了使用自定义按钮控制Soundcloud HTML5 Widget Player的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I wanted to do something similar to what I saw on SoundClouds HTML5 Widget API PLayground page where they have external buttons that control the player : http://w.soundcloud.com/player/api_playground.html

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

Eventually I'll be hiding the player widget itself and using those buttons as the music controller.

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

Any suggestions or tips would be awesome, I posted it here: http://jsfiddle.net/alexsethalex/qcKed/1/

推荐答案

您是否查看了 Widget API文档

这是一个非常简单的例子:

Here's a super simple example:

<!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>

这篇关于使用自定义按钮控制Soundcloud HTML5 Widget Player的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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