Re: support for rdio player ? -- RDIO --

35 views
Skip to first unread message

Sikiru Braheem

unread,
Jun 29, 2012, 7:27:36 AM6/29/12
to bst-p...@googlegroups.com
Hi Gero,

Very cool music site.  Will provide support when I am less busy.

You may want to vote for the issue also. @ http://code.google.com/p/bst-player/issues/detail?id=61

Regards.

On Thursday, 28 June 2012 13:07:15 UTC+1, Gero wrote:
Hello Sikiru,

I want to gratulate you to this wonderful library. I use it together with smartgwt and it works fine (btw: I derived my own player interface using smartgwt Progressbar).

Do you know http://rdio.com ?

It is a huge collection music with a very well defined interface see http://developer.rdio.com/
Price is moderate (5 € per month) and you get legal access to over 10.000.000 titles of music of all styles.

I suggest that you add support for rdio to the best player.

Gero

========================================================
to help you get started I wrote a small script that shows how to access the player

<pre>

=========================================== rdio_demo.html
<html>
<head>
<title>Rdio Player IMSAR</title>
<script src="jquery-1.5.1.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script src="rdio_demo.js"></script>
</head>
<body>
<div id="apiswf"></div>

<table>
<tr>
<td><img src="" id="icon" /></td>
<td>
<pre>
playState = <span id="playState"></span>
track = <span id="track"></span>
duration = <span id="duration"></span>
key = <span id="key"></span>
album = <span id="album"></span>
artist = <span id="artist"></span>
position = <span id="position"></span>
</pre>
</td></tr>
</table>

<input id="play_key" value="a1174173" size="8">
<input id="track_key" value="1" size="1">
<input id="position_key" value="0" size="2">
<button id="play">Play Track at Position</button><br>
<button id="stop">Stop</button>
<button id="pos0">@0</button>
<button id="pos20">@20</button>
<button id="pos50">@50</button>
<button id="pause">Pause</button>

<div id="blocked" style="display:none;"><hr/><span style="color:red">
There is only one common RDIO account for all IMSAR users.<br/>
The current play back was stopped because another IMSAR user just started to play music via RDIO.<br/>
You can resume your play by clicking play again - but this will block the other user(s).<br/>
To avoid this problem sign up for your own private account on rdio.com.</span>
</div>
<div id="invalid" style="display:none;">
<hr/><span style="color:red">There is a problem with the access token for RDIO</span>
</div>

</body>
</html>

=========================================== rdio_demo.js

// a global variable that will hold a reference to the api swf once it has loaded
var apiswf = null;

var advanceToTrack=false;
var advanceToPosition=false;


$(document).ready(function() {
// on page load use SWFObject to load the API swf into div#apiswf
var flashvars = {
'playbackToken': "GAlPc2Nt_____... request your personal token from rdio and fill in here ",
'domain': "yourdomain.com",
'listener': 'rdioListener' // the global name of the object that will receive callbacks from the SWF
}
var params = {
'allowScriptAccess': 'always'
};
var attributes = {};
swfobject.embedSWF('http://www.rdio.com/api/swf/', // the location of the Rdio Playback API SWF
'apiswf', // the ID of the element that will be replaced with the SWF
1, 1, '9.0.0', 'expressInstall.swf', flashvars, params, attributes);


// set up the controls
$('#play').click(function() {
apiswf.rdio_play($('#play_key').val());
advanceToTrack = true;
$('#blocked').hide();
});
$('#stop').click(function() { apiswf.rdio_stop(); });
$('#pos0').click(function() { apiswf.rdio_seek(0); });
$('#pos20').click(function() { apiswf.rdio_seek(20); });
$('#pos50').click(function() { apiswf.rdio_seek(50); });
$('#pause').click(function() { apiswf.rdio_pause(); });
});


// the global callback object
var rdioListener = {};

rdioListener.ready = function ready(user) { // Called once the API SWF has loaded and is ready to accept method calls. // find the embed/object element apiswf = $('#apiswf').get(0); } rdioListener.playStateChanged = function playStateChanged(playState) { // The playback state has changed. // The state can be: 0 - paused, 1 - playing, 2 - stopped, 3 - buffering or 4 - paused. switch (playState) { case 0: $('#playState').text("paused"); break; case 1: $('#playState').text("playing"); break; case 2: $('#playState').text("stopped"); break; case 3: $('#playState').text("buffering"); break; case 4: $('#playState').text("paused"); break; } if (advanceToTrack==true && playState==1) { // select desired track var trackNo = parseInt($('#track_key').val()); apiswf.rdio_setCurrentPosition(trackNo-1); // zero based numbers advanceToTrack=false; advanceToPosition=true; } else if (advanceToPosition==true && playState==1) { var position = parseFloat($('#position_key').val()); apiswf.rdio_seek(position); // zero based numbers advanceToPosition=false; } } rdioListener.playingTrackChanged = function playingTrackChanged(playingTrack, sourcePosition) { // The currently playing track has changed. // Track metadata is provided as playingTrack and the position within the playing source as sourcePosition. if (playingTrack != null) { $('#track').text(playingTrack['name']); $('#album').text(playingTrack['album']); $('#artist').text(playingTrack['artist']); $('#icon').attr('src', playingTrack['icon']); $('#duration').text(playingTrack['duration']); $('#key').text(playingTrack['key']); } } rdioListener.playingSourceChanged = function playingSourceChanged(playingSource) { // The currently playing source changed. // The source metadata, including a track listing is inside playingSource. } rdioListener.positionChanged = function positionChanged(position) { //The position within the track changed to position seconds.
// This happens both in response to a seek and during playback. $('#position').text(position); } rdioListener.playingSomewhereElse = function playingSomewhereElse() { // An Rdio user can only play from one location at a time. // If playback begins somewhere else then playback will stop and this callback will be called. $('#blocked').show(); }
=======================================================================================================

</pre>
Reply all
Reply to author
Forward
0 new messages