i have used the following code in a file browser, to look for a song through the file directory, and select a file:
try {
if (fileName.endsWith(".mp3") || fileName.endsWith(".amr") || fileName.endsWith(".wma"))
{
is = null;
FileConnection fc =
(FileConnection)Connector.open("file://localhost/" + currDirName + fileName);
is = fc.openInputStream();
midlet.getDisplay().setCurrent(midlet.get_mp3PlayerForm());
and the following code to play the selected file:
private void doPlay() {
try {
player = Manager.createPlayer(fileConnection.get_IS(), "audio/amr");
player.prefetch();
player.start();
} catch (IOException x) {
x.printStackTrace();
With this coding, i am getting different outcomes on different phones.
On Nokia N70, there is 15second wait before the song starts playing.
On Nokia N91, the song does not play at all.
On Sony K800i, the song plays immediately.
I feel this has something to do with the openOutputStream method.
Can somebody please help me with this.
Thanks,
Neil

Reply With Quote

