04-05-2010, 04:22 AM
|
#3 (permalink)
|
| Knows Where the Search Button Is
Join Date: Jan 2010 Model: 8900 PIN: N/A Carrier: trainee
Posts: 30
Post Thanks: 0 Thanked 0 Times in 0 Posts
| Reply hi,
thnks 4 ur response,
i m sending my code to u:
class StartRecordingThread extends Thread
{
public void run()
{
videoEncodings = System
.getProperty("video.encodings");
final boolean hasVideoRecording = videoEncodings != null
&& videoEncodings.length() > 0;
if (player == null || recorder == null)
{
if (hasVideoRecording)
{
int encodingSpace = videoEncodings
.indexOf(' ');
if (encodingSpace != -1)
{
videoEncodings = videoEncodings
.substring(0, encodingSpace);
}
player = Manager
.createPlayer("capture://video?"
+ videoEncodings);
player.start();
VideoControl video = (VideoControl) player
.getControl("VideoControl");
cameraView = (Field) video
.initDisplayMode(
VideoControl.USE_GUI_PRIMITIVE,
"net.rim.device.api.ui.Field");
getApplication().invokeLater(new Runnable()
{
public void run()
{
add(cameraView);
}
});
}
else
{
player = Manager
.createPlayer("capture://audio");
player.start();
}
recorder = (RecordControl) player
.getControl("RecordControl");
}
for(int i=0;i<4;i++)
{
String PATH = System.getProperty("fileconn.dir.videos") + "truncate"+i+".3gp";
try{
conn = (FileConnection)Connector.open(PATH,Connector.READ _WRITE);
if(!conn.exists())
conn.create();
conn.truncate(0);
// conn.close();
OutputStream out=conn.openDataOutputStream();
recorder.setRecordStream(out);
recorder.startRecord();
recording = true;
Thread.currentThread().sleep(5000);
recorder.stopRecord();
recorder.commit();
recording = false;
out.close();
conn.close();
FileConnection fc=(FileConnection)Connector.open(PATH,Connector.R EAD_WRITE);
InputStream is=fc.openInputStream();
final int len=(int)fc.fileSize();
byte b[]=new byte[len];
is.read(b);
String str=new String(b);
is.close();
fc.close();
HttpConnection http=(HttpConnection)Connector.open(URL);
http.setRequestMethod(HttpConnection.POST);
DataOutputStream out1=http.openDataOutputStream();
out1.write(b,0,b.length);
out1.flush();
http.close();
}
if(i==3)
{
player.stop();
player.deallocate();
}
}//end of for loop
this code i m using,but d prob is,it starts sending file to server from second file,while for the 1st,contentlength() is displaying on server side,
but after that it enters into phase,where it starts sending from second file.
dont know where i m mistaking
thnks |
| Offline
| |