Use the Netvibes podcast player from your UWA widget
Not everyone knows it, but you can access and control the internal podcast player using UWA – and we’ll show you how in this very article.
The example used here is the excellent Web Radio Player widget, built by Maurice Svay and which lets you play audio streams in MP3 format from the renown ShoutCast service.
When installed in Netvibes, it uses the Netvibes podcast player, which is also used when you listen to an audio stream from a podcast feed that you added to your Netvibes page. As advertised, on platforms other than Netvibes, the widget will let you play radios with your favorite desktop player: Winamp, Windows Media Player, iTunes, etc. – basically any player that supports .mp3 files (or .pls files, since this widget cleverly parses them to send the .mp3 to the podcast player). So your widget is not limited to Netvibes!
Obviously we won’t dissect the whole source code here, that would require and go directly to the code related to the podcast player, which consists simply of a call to one method:
AudioPlayer.play(streamURL, 'Name of the stream');
This method triggers the launch of the podcast player. To be a little cleaner, the code first check for the presence of the AudioPlayer.play method before even launching the Ajax request that fetch the steam and launching AudioPlayer.play. Here is an overview of how Maurice does it:
Radio.parseList = function(text){
// code that fetches and displays
// every station of the PLS file as a link
if (AudioPlayer.play){
Radio.loadStation(this.href);
return false;
}
// HTML generation
}
Radio.loadStation = function(url){
UWA.Data.getText(url, Radio.playStation);
}
Radio.playStation = function(text){
// Data handling
AudioPlayer.play(playableStream, 'Web Radio Player');
}
play is not the only method available! AudioPlayer also gives you access to pause and stop, if you ever want to fully control the podcast player from within your widget. Learn all about it on the documentation page for the AudioPlayer objet!
Tags: audioplayer, javascript, netvibes, uwa








November 23rd, 2007 at 11:43 am
Really nice but listening an mp3 ‘stream’ (like shoutcast) with a flash application could be harmful cause Flash Player considers the ‘stream’ as a never ending mp3 file and inflate memory usage.
I recommend reading this page for more information : http://www.draftlight.net/dnex/mp3player/minicaster/explained.php
November 25th, 2007 at 2:58 pm
some body explain how to listen to the webradio…pls email me.Thankx
December 4th, 2007 at 12:47 am
Hello,
very great idea of widget but on my netvibes the AudioPlayer doesn’t work (for the radios and for the podcasts).
Thanks.
regards
December 4th, 2007 at 11:22 am
George: if the widget doesn’t work for you, please contact the author. There is a feedback form on the widget’s Ecosystem page once you’re logged in, or a classic comment form.
Arnaud: same for you I guess. Please contact the author directly. However, since the widget relies on external plugins, it might not work 100% for everyone – your mileage may vary.
December 9th, 2007 at 9:06 pm
Hello,
Thank you I love this kind of JavaScript-APIs. Maybe I can use it in my next web design projects.
February 10th, 2008 at 2:23 am
Thanks for the code
April 20th, 2008 at 6:36 pm
i did not understand webradio
June 27th, 2008 at 12:42 pm
can i use my site this code? really good? Thanks for the code.