not able to play file when set data source to the sdcard fil

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

not able to play file when set data source to the sdcard fil

Postby kartik_saltriver » Mon Apr 13, 2009 10:50 am

Hello,
I am trying to play file which is stored in SDCARD in emulator. I have Linux O/S. So i need to provide command in run configuration.

I am providing following parameter.

-sdcard /usr/android/sdcard/mysdcard.iso -audio oss
[i]

The following is my code to play file.

try
{
mMediaPlayer.setDataSource("/sdcard/test_cbr.mp3");
mMediaPlayer.prepare(); // Giving error.
mMediaPlayer.start();

}
catch(Exception e)
{
System.out.println("exception="+e.toString());
}



It is giving me error when i am calling prepare(). Cans some one tell me what could be wrong in it ? Am i using wrong separator in run configuration ?
kartik_saltriver
Freshman
Freshman
 
Posts: 7
Joined: Wed Apr 01, 2009 5:50 am

Top

Postby androidUser » Wed Apr 15, 2009 1:32 pm

Here is the code, which i can able to play the video in windows xp


public class PlayVideo extends Activity {

VideoView videoHolder;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.playvideo);

Log.d("LBS: ","1");

/*final Button playVideo = (Button) findViewById(R.id.video1);*/

Log.d("LBS: ","2");
getWindow().setFormat(PixelFormat.TRANSLUCENT);

videoHolder = new VideoView(PlayVideo.this);
videoHolder.setMediaController(new MediaController(PlayVideo.this));
setContentView(videoHolder);

Log.d("LBS: ","3");

videoHolder.setVideoURI(Uri.parse("file:///sdcard/test.3gp"));
videoHolder.requestFocus();
videoHolder.start();



}
}

Try this :)
androidUser
Junior Developer
Junior Developer
 
Posts: 24
Joined: Sun Apr 05, 2009 1:08 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: Google Feedfetcher and 4 guests