You Are Here:

Community: Developer Discussion Boards

Reply « Previous Thread | Next Thread »

#1 Old radio streaming - 2008-03-31, 10:16

Join Date: Mar 2007
Posts: 54
jonneymendoza
Offline
Regular Contributor
Hi im trying to stream this following link: http://shoutcast.com/sbin/shoutcast-...e=filename.pls
and/or

http://mediaweb.musicradio.com/Playlist.asx?StreamID=8 but it fails on realizing the player with an exception indicating realize failed.

my code is this

Code:
debug.append("creating the player using url of " + url + "\n");
            player = Manager.createPlayer(url);
         
            debug.append("Player has been created  and now realizing the player  \n");
            player.realize();        
            debug.append("realize state and now setting it up for prefetch \n");
            player.prefetch();
            debug.append("prefetch state and going to start the playback\n");
 
//debug is a Form displaying what is happening in the background
Reply With Quote

#2 Old Re: radio streaming - 2008-03-31, 22:30

Join Date: Apr 2003
Posts: 6,408
Location: USA, CA
hartti's Avatar
hartti
Offline
Nokia Expert
That file is a playlist, not a stream. You need to download that pls-file, parse the contents and open a correct stream URL.

ALso make sure that the device in question suppoorts http-streaming as the URLs in the playlist are all http based. Which device are you using?

Hartti
Reply With Quote

#3 Old Re: radio streaming - 2008-04-01, 11:49

Join Date: Mar 2007
Posts: 54
jonneymendoza
Offline
Regular Contributor
im using a motorola v9 device. how would i parse info from the pls file? i have downloaded the file on a desktop pc and opened it in notepad and the content of the file is somthing like this:

[playlist]
numberofentries=21
File1=http://scfire-nyk-aa05.stream.aol.com:80/stream/1071
Title1=(#1 - 66/500) -=[:: HOT 108 JAMZ ::]=- #1 FOR HIP HOP - 128K HD) * CONNECT FROM OUR WEBSITE ......


do i use this link "http://scfire-nyk-aa05.stream.aol.com:80/stream/1071" and make a normal http connection? how would i specify and know the stream time when using Player.CreatePlaye("http://scfire-nyk-aa05.stream.aol.com:80/stream/1071", "audio/mp3")
Last edited by jonneymendoza : 2008-04-01 at 11:56.
Reply With Quote

#4 Old Re: radio streaming - 2008-04-02, 19:29

Join Date: Apr 2003
Posts: 6,408
Location: USA, CA
hartti's Avatar
hartti
Offline
Nokia Expert
The playlist contents really looks that way. If those URLs are mp3 files then you are on the right track!

Hartti
Reply With Quote

#5 Old Re: radio streaming - 2008-04-21, 00:50

Join Date: Mar 2003
Posts: 9
jenium
Offline
Registered User
Quote:
Originally Posted by hartti View Post
That file is a playlist, not a stream. You need to download that pls-file, parse the contents and open a correct stream URL.

ALso make sure that the device in question suppoorts http-streaming as the URLs in the playlist are all http based. Which device are you using?

Hartti
Http streaming is supported only for audio/amr and audio/amr-nb(?) and only for S60 3rd FP1 devices. AFAIK
Reply With Quote

#6 Old Re: radio streaming - 2008-10-02, 11:21

Join Date: Sep 2008
Posts: 9
popeztl
Offline
Registered User
I am facing the same problem. seems I am not able to stream by using the link from pls-file.
for instance: http://213.251.141.62:8006
and such an error thrown out:
javax.microedition.media.MediaException: Cannot create a Player for: Unsupported content type
Reply With Quote

#7 Old Re: radio streaming - 2008-10-02, 11:35

Join Date: Nov 2007
Posts: 2,029
Location: Rome, Italy
Send a message via MSN to jappit Send a message via Skype™ to jappit
jappit's Avatar
jappit
Offline
Forum Nokia Champion
Hi popeztl,

error message is self-explaining: you're trying to stream a file whose format is not supported on the device itself.

You can refer to this document to check supported media types on Nokia devices:

http://www.forum.nokia.com/info/sw.n..._0_en.xls.html

Pit


www.jappit.com - mobile and web blog
Reply With Quote

#8 Old Re: radio streaming - 2008-10-02, 11:49

Join Date: Sep 2008
Posts: 9
popeztl
Offline
Registered User
hey jappit,

thanks for ur reply. I was trying to do it on Nokia N95. and the stream content type is aacp. which should be support by N95.

I am guessing if it is because the handset can not recognize the content type of the source.
Last edited by popeztl : 2008-10-02 at 12:08.
Reply With Quote

#9 Old Re: radio streaming - 2008-10-02, 22:50

Join Date: Apr 2003
Posts: 6,408
Location: USA, CA
hartti's Avatar
hartti
Offline
Nokia Expert
aacp... do not think so.
aac instead, yes

http://www.forum.nokia.com/info/sw.n..._0_en.xls.html

Hartti
Reply With Quote

#10 Old Re: radio streaming - 2008-10-03, 09:32

Join Date: Sep 2008
Posts: 9
popeztl
Offline
Registered User
hey hartti,

I am quite sure that N95 do support AAC+.
check this link
http://www.forum.nokia.com/devices/N95
Reply With Quote

#11 Old Re: radio streaming - 2008-10-04, 01:52

Join Date: Apr 2003
Posts: 6,408
Location: USA, CA
hartti's Avatar
hartti
Offline
Nokia Expert
Ok, so my answer was too cryptic one.

According to the document I referred to Java ME on N95 supports AAC+, yes.
But.
File extension is aac
and MIME type is audio/aac

Do you use these?

Hartti
Reply With Quote

#12 Old Re: radio streaming - 2008-10-06, 10:43

Join Date: Sep 2008
Posts: 9
popeztl
Offline
Registered User
Hey Hartti,

thanks for ur helping. I guess I didn't discribe the problem clearly. Actually the problem is I was trying to stream a radio from a pls-file's link. The content type and format are not declared at all.

url = "http://www.***.com:8032/";
player = Manager.createPlayer(url);

and such an error thrown out:
javax.microedition.media.MediaException: Cannot create a Player for: Unsupported content type.

I have no idea how to achieve my idea. Could you give me any advisory?
Reply With Quote

#13 Old Re: radio streaming - 2008-10-22, 10:52

Join Date: Mar 2008
Posts: 51
laili_aidi
Offline
Regular Contributor
Quote:
Originally Posted by popeztl View Post
Hey Hartti,

thanks for ur helping. I guess I didn't discribe the problem clearly. Actually the problem is I was trying to stream a radio from a pls-file's link. The content type and format are not declared at all.

url = "http://www.***.com:8032/";
player = Manager.createPlayer(url);

and such an error thrown out:
javax.microedition.media.MediaException: Cannot create a Player for: Unsupported content type.

I have no idea how to achieve my idea. Could you give me any advisory?
hi popezt,
Unsupported content type means that the media format not supported by the device/emulator. have u check what supported content type of ur device/emulator ? and dont forget about the codec too. u must read the device spesification about audio/video codec. i mention this in this thread too if u want to read that :
http://discussion.forum.nokia.com/fo...d.php?p=489688


may it helps
-regards-
adek aidi
Reply With Quote

#14 Old Talking Re: radio streaming - 2009-03-26, 11:28

Join Date: Feb 2009
Posts: 6
maheshkanda
Offline
Registered User
Hi ,
I am also presently working on the same the theme is i achieved the first step of retrieving the player and playing the song in the mobile here i used the PHP interaction to buffer the data so it is taking more than 15 min to play the song and i observed that it is supporting progressive download. that means it storing the data in to the memory then after it is playing here i set time limit as 24 mins i am sending my code of mine will any one help please..........
This is the PHP server side coding

Quote:

<?
set_time_limit(1440);

$all_channels='';

function parse_radios($xmldata) {

global $all_channels;

$channelgroup='';


$xmldata = mb_convert_encoding($xmldata, "utf-8");
$xmldata = preg_replace('/&(?![#]?[a-z0-9]+;)/i', "+", $xmldata);


$xml = new XMLReader();
$xml->XML($xmldata);

while ($xml->read()) { if ($xml->name == "mr") { // "Records"

$count=0;

while($xml->read()) {


if ($xml->name == "channel_group") { // "SubIdStatisticRecord"

if ($xml->hasAttributes) {

$channelgroup=$xml->getAttribute("title");

}

}else
if ($xml->name == "channel") { // "SubIdStatisticRecord"

if ($xml->hasAttributes) {

$count++;

//if ($count<500) {
$all_channels .= $channelgroup.";".mb_convert_encoding($xml->getAttribute("title"), "ISO-8859-1", "utf-8").";".$xml->getAttribute("url")."\n";
//}
}
}

} //while




} //if mr


} //while oberste





}



/************************************************************************************************
Start main program
*************************************************************************************************/


$playradio_url = strip_tags($_GET['play']);
$client_id = strip_tags($_GET['clientid']);

$rlist = strip_tags($_GET['rlist']);



if ( ( ($playradio_url!="") && ($client_id!="") ) || ($rlist!="") )
{


if ($rlist!="") { //Radioliste laden

$handle = fopen("mr.xml", "rb");
$contents = '';
while (!feof($handle)) {
$contents .= fread($handle, 8192); //8192
}
fclose($handle);


parse_radios($contents);


echo $all_channels;


} else { //play Radio


$starttime=time();


$urlpathstart = strpos($playradio_url,"/",7);

if ($urlpathstart=="") $urlpathstart=strlen($playradio_url);

$urlportstart = strripos($playradio_url,":",7);



if ($urlportstart!=0) {

$host = substr($playradio_url,7, ($urlportstart-7) ); // length 3. param

} else
$host = substr($playradio_url,7, ($urlpathstart-7) ); // length 3. param



$port=80;

if ($urlportstart!=0) {

$port = substr($playradio_url, $urlportstart+1, ($urlpathstart-$urlportstart)-1);

}


if ($urlpathstart==strlen($playradio_url)) { $path="/"; } else
$path = substr($playradio_url, $urlpathstart, strlen($playradio_url)-$urlpathstart+1 );


//echo "host ", $host, " <br>" ;
//echo "port ", $port, " <br>" ;
//echo "path ", $path, " <br>" ;


//1 ICY 200 OK
//2 icy-notice1:
//This stream requires Winamp

//3 icy-notice2:SHOUTcast Distributed Network Audio Server/Linux v1.9.8

//4 icy-name:Radioseven - www.radioseven.se
//5 icy-genre:Dance Trance House
//6 icy-url:http:www.radioseven.se
//7 content-type:audio/mpeg
//8 icy-pub:1
//9 icy-br:128
//10
//11 Musikdaten





$fp = fsockopen($host, $port, $errno, $errstr, 30) or die("Unable to connect to server!");


$buf = "GET ".$path." HTTP/1.0\r\nIcy-MetaData:0\r\n\r\n";
fwrite($fp, $buf);

//get next line
$buf = fgets($fp, 1024);


//while pointer is not at EOF
//get next line
$buf = fgets($fp, 1024);

//delete trash (shoutcast headers)
$buf = fgets($fp, 1024);
$buf = fgets($fp, 1024);
$buf = fgets($fp, 1024);
$buf = fgets($fp, 1024);
$buf7 = fgets($fp, 1024); //Datentyp
$buf = fgets($fp, 1024);
$buf = fgets($fp, 1024);
$buf = fgets($fp, 1024);


if ($buf == "\r\n") {
// echo "break";
//break;
// Zeile 10 leere Zeile, ab 11 Daten

}





header('Content-Length: 50000000');
//header('Content-type: audio/mpeg');
header($buf7);

$timeover=0;

while ( (!feof($fp)) && ($timeover==0) ) {


//echo $buf;


//$fout = fopen("dump" .$client_id. ".mp3", "w");

while (!feof($fp)) {

if ( (time()-$starttime)>1440) { //1440s 24 min

$timeover=1;
break;

}

$buf = fread($fp, 512); //512 music data
// fwrite($fout, $buf);
echo $buf;

}

}


fclose($fp);



} //play radio




} //params






?>


This one is the server side xml file

Quote:
<mr start="1">
<channel_group id="9980" title="Techno">
<channel id="2339" genre="g" title="T4E" url="http://89.146.206.12:8000/" />
<channel id="2213" genre="g" title="TechnoBase.FM" url="http://78.159.104.181:80/" />
<channel id="2337" genre="g" title="Pulsradio" url="http://91.121.96.201:5000/" />
<channel id="2337" genre="g" title="RadioSeven.se" url="http://212.247.153.210:8001/" />

</channel_group>


</mr>
Reply With Quote

#15 Old Talking Re: radio streaming - 2009-03-26, 11:38

Join Date: Feb 2009
Posts: 6
maheshkanda
Offline
Registered User
This is the RMS in j2me
Quote:



import java.io.*;
import java.util.*;
import javax.microedition.rms.*;

public class RMSCache {

private final String mName;
private Hashtable mMap;

public RMSCache(String name) throws RecordStoreException {
mName = name;
read();
}

// Public methods.
public void set(String key, String value)
throws RecordStoreException {
Object old = mMap.put(key, value);
if (old == null || !old.equals(value))
write();
}

public void remove(String key) throws RecordStoreException {
if (mMap.remove(key) != null)
write();
}

public String get(String key) {
return (String)mMap.get(key);
}

// Implementations.
private void read() throws RecordStoreException {
RecordStore rs = RecordStore.openRecordStore(mName, true);
mMap = new Hashtable();
try {
RecordEnumeration re =
rs.enumerateRecords(null, null, false);
while (re.hasNextElement()) {
byte[] record = re.nextRecord();

parseRecord(record);
}
}
finally { rs.closeRecordStore(); }
}


private void parseRecord(byte[] record) {
try {
ByteArrayInputStream raw =
new ByteArrayInputStream(record);
DataInputStream in = new DataInputStream(raw);
String key = in.readUTF();
String value = in.readUTF();
mMap.put(key, value);
}
catch (IOException ioe) {
System.out.println("Bad record in " + mName + ".");
}
}


private void write() throws RecordStoreException {
// Draconian: delete the old one, write a new one.
try { RecordStore.deleteRecordStore(mName); }
catch (RecordStoreNotFoundException rsfe) {} // No problem.
RecordStore rs = RecordStore.openRecordStore(mName, true);
try {
Enumeration keys = mMap.keys();
while (keys.hasMoreElements()) {
String key = (String)keys.nextElement();
String value = (String)mMap.get(key);
try {
byte[] record = packRecord(key, value);
rs.addRecord(record, 0, record.length);
}
catch (IOException ioe) {
System.out.println("Error packing in " + mName + " : " +
key + " -> " + value);
}
}
}
finally { rs.closeRecordStore(); }
}


private byte[] packRecord(String key, String value)
throws IOException {
ByteArrayOutputStream raw = new ByteArrayOutputStream();


DataOutputStream out = new DataOutputStream(raw);
out.writeUTF(key);
out.writeUTF(value);
return raw.toByteArray();
}

}


Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Download java based streaming radio srinivasvurrinkala Mobile Java Media (Graphics & Sounds) 3 2009-03-26 17:45
Can I streaming Video from internet on S60 3rd edition? jianyu_21 Mobile Java Media (Graphics & Sounds) 8 2008-04-25 06:15
3gp streaming to Nokia 6680/6630 wasbo Streaming and Video 23 2007-04-24 12:23
Streaming EDGE clip in GPRS coverage zivs Streaming and Video 0 2006-08-22 18:22
Audio Streaming in J2ME.... senthilkumar05 Mobile Java Media (Graphics & Sounds) 1 2006-02-22 15:05

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ