Reading and writing to same file.

All your problems with Audio, Video and Images.

Reading and writing to same file.

Postby coolalok » Fri Jan 15, 2010 3:04 pm

Hi guys,
I have a basic question. Can we write to and read from the same file at a time ?
I want to do this for Media Player application. One thread writes to the file and the other thread reads the file to play.
I have seen the demo app custom-media-streaming-with-mediaplayer where they pause playing after a temporary file is read and then set the data source to a new file with a new player. I dont want the pause effect to come (thats obviously required). I am getting a wierd behaviour where only the first chunk of data is being played again and again.
Thanks,
Alok.
Android......
Here I come!!!
User avatar
coolalok
Developer
Developer
 
Posts: 29
Joined: Tue Sep 01, 2009 7:35 pm
Location: Pune,India

Top

Postby willis127 » Mon Jan 18, 2010 4:08 am

reading from a file and writing to a file is possible in other uses however, Android mediaplayer locks the file while it is using it. So you cannot write to the same file that mediaplayer is holding. That's why you have the moveFile method in the custom Audio streaming tutorial. it moves from what your downloading to the temporary playing file while it still downloads.
willis127
Freshman
Freshman
 
Posts: 9
Joined: Wed Nov 11, 2009 8:03 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 15 guests