RE: [android-developers] Re: Encoder???
hi skink,
Now i have used inputstream but it give me Exeption (null) at while((bytesRead = is.read(buffer)) != -1) on server side.
here server side code that i am using.
try
{
// create stream to Network
InputStream in = clientSocket.getInputStream();
// create stream to file
OutputStream os = new FileOutputStream("video.3gp", true);
byte[] buffer = new byte[4096];
int bytesRead;
while((bytesRead = is.read(buffer)) != -1)
{
os.write(buffer, 0, bytesRead);
}
is.close();
os.close();
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
Regards.
Now i have used inputstream but it give me Exeption (null) at while((bytesRead = is.read(buffer)) != -1) on server side.
here server side code that i am using.
try
{
// create stream to Network
InputStream in = clientSocket.getInputStream();
// create stream to file
OutputStream os = new FileOutputStream("video.3gp", true);
byte[] buffer = new byte[4096];
int bytesRead;
while((bytesRead = is.read(buffer)) != -1)
{
os.write(buffer, 0, bytesRead);
}
is.close();
os.close();
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
Regards.
> Date: Wed, 25 Jan 2012 01:47:56 -0800
> Subject: Re: [android-developers] Re: Encoder???
> From: pskink@gmail.com
> To: android-developers@googlegroups.com
>
>
>
> Muhammad UMER wrote:
> > hi skink,
> > Thanks for your reply, I am using server side code to receive each frame is perfect. but when i use this server for mediaRecorder it gives the invalid stream header: 00000000, i am using
> > ObjectInputStream to receive the data. on client side (android), i am using the ParcelFileDescriptor.fromSocket(socket), is ParcelFileDescriptor send video in object form?
> >
> > //// here is my server side code.
> >
> > try
> > {
> > // create stream to Network
> > ois = new ObjectInputStream(clientSocket.getInputStream());
> >
> > // create stream to file
> > FileOutputStream fos = new FileOutputStream("video.3gp", true);
> > ObjectOutputStream out = new ObjectOutputStream(fos);
> >
> > while(true)
> > {
> >
> > // read data in object form from network
> > byte [] byt = (byte[]) ois.readObject();
> >
> > // write data to file
> > out.write(byt);
> > out.flush();
> > }
> > }
> > catch (Exception e)
> > {
> > System.out.println(e.getMessage());
> > }
> >
> >
>
>
> Dont use ObjectInputStream, just use InputStream
>
> pskink
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> Subject: Re: [android-developers] Re: Encoder???
> From: pskink@gmail.com
> To: android-developers@googlegroups.com
>
>
>
> Muhammad UMER wrote:
> > hi skink,
> > Thanks for your reply, I am using server side code to receive each frame is perfect. but when i use this server for mediaRecorder it gives the invalid stream header: 00000000, i am using
> > ObjectInputStream to receive the data. on client side (android), i am using the ParcelFileDescriptor.fromSocket(socket), is ParcelFileDescriptor send video in object form?
> >
> > //// here is my server side code.
> >
> > try
> > {
> > // create stream to Network
> > ois = new ObjectInputStream(clientSocket.getInputStream());
> >
> > // create stream to file
> > FileOutputStream fos = new FileOutputStream("video.3gp", true);
> > ObjectOutputStream out = new ObjectOutputStream(fos);
> >
> > while(true)
> > {
> >
> > // read data in object form from network
> > byte [] byt = (byte[]) ois.readObject();
> >
> > // write data to file
> > out.write(byt);
> > out.flush();
> > }
> > }
> > catch (Exception e)
> > {
> > System.out.println(e.getMessage());
> > }
> >
> >
>
>
> Dont use ObjectInputStream, just use InputStream
>
> pskink
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home