Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Audio Play in Android through network.

Audio Play in Android through network.

All your problems with Audio, Video and Images.

Audio Play in Android through network.

Postby anshu » Thu Apr 07, 2011 9:34 am

Hi friends,

I am trying to play a media file(.wav) that I am receiving through network in Smaller chunks and using Audio Track I am playing. My Design look like.

1.

My Android Application running as UDP server , I will initialize the buffer with proper minBufferSize and all other parameters according to media file.
2.

My other Java Code convert media file in Byte array and every 20 miliseconds delay I am sending the 320 byte(try the other size also) to server.
3.

Server receiving data put the data into track(write ) and play.

Now problem is that:

1. After stating the play , in some seconds playing data is shrinking. If I ll close the connection and again start it play proper and after some time it shrinks again. How to Avoid This shrinking of Data. Second thing if I want to some time extent to reinitialize my track. Is'nt any way there?

My Code snippet is like:

try {
int socket_port =9876 ;
int MAX_BUF=742;
aSocket = new DatagramSocket(socket_port);
byte[] buffer = new byte[MAX_BUF];
/****************track initialization*******************/
System.out.println(":Track Creation: a");

int bufferSize =AudioTrack.getMinBufferSize(8000,AudioFormat.CHANNEL_CONFIGURATION_MONO,AudioFormat.ENCODING_PCM_16BIT);
System.out.println(":Track Creation: a"+bufferSize);

track = new AudioTrack(AudioManager.STREAM_MUSIC,8000,
AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT,
bufferSize, AudioTrack.MODE_STREAM);


/****************************************************/
DatagramPacket request = new DatagramPacket(buffer,
buffer.length);

byte[] audiobuffer=new byte[MAX_BUF];

while(true){
aSocket.receive(request);

//getting the data from Datagram Packet:
audiobuffer=request.getData();
track.write(audiobuffer, 0, audiobuffer.length);
track.play();

try {
Thread.sleep(40);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

track.flush();

}
catch (SocketException e) {

System.out.println("Socket: " + e.getMessage());
}
catch (IOException e) {
System.out.println("IO: " + e.getMessage());
}
}

}

/****************************************************/

Give me some Guidance?

RE: why After some extent of time the paying data shrinked, If I want to reintialize the track , that sound elapsed, Can we reintialize the track after some time of extent
anshu
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Apr 07, 2011 9:29 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 5 guests