-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex2.html
55 lines (50 loc) · 2.84 KB
/
ex2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SC Player JS API</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="Matas Petrikas">
</head>
<body>
<script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="./soundcloud.player.api.js"></script>
<script type="text/javascript" charset="utf-8">
// ------- a simple auto-play example ----------
// $(function() {
$(document).bind('soundcloud:onPlayerReady', function(event, data) {
// the soundcloud.player.api.js wrapper triggers custom events
// please refer to JS API wrapper for full event list
var apiUrl = data.mediaUri + '.json?callback=?';
// call the SoundCloud API for more info
$.getJSON(apiUrl, function(data) {
// please refer to SoundCloud api for the resource types
// http://wiki.github.com/soundcloud/api/03-resource-types
// display the title
$('<h1>' + data.title + '</h1>').appendTo(document.body);
// display the artwork
var img = new Image();
img.src = data.artwork_url;
$(img).appendTo(document.body);
});
});
// });
</script>
<!--
Please note the following differences from the standard embed code:
The 'object' tag has an 'id' attribute set to the player identifier (yourPlayerId),
also, the 'embed' tag has a 'name' attribute set to the player identifier (yourPlayerId),
also, there's the query parameter 'object_id' is set to the player identifier (yourPlayerId).
The query parameter 'enable_api' is also set to true, so the callback from Flash will be fired.
These settings are mandatory, for the JS API to work across a wide range of browsers.
If you're using SWFObject or similar Flash generators, set 'id' to the player identifier,
also add 'enable_api:true, object_id:"yourPlayerId"' to the flashvars object
-->
<object height="81" width="100%" id="yourPlayerId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fmatas%2Fhobnotropic&enable_api=true&object_id=yourPlayerId"></param>
<param name="allowscriptaccess" value="always"></param>
<embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fmatas%2Fhobnotropic&enable_api=true&object_id=yourPlayerId" type="application/x-shockwave-flash" width="100%" name="yourPlayerId"></embed>
</object>
</body>
</html>