i push the file mj.mp4 onto the vm device through eclipse and can browse
the it in File Explore at /mnt/sdcard/mj.mp4
my java code like:
public class MyActivity extends Activity
{
private VideoView mVideo;
private MediaController mMediaController;
private String mUri = "";
@Override
public void onCreate(Bundle savedInstanceState)
{
this.mUri = this.getExternalStoragePath() + "/mj.mp4";
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
this.mVideo = (VideoView)findViewById(R.id.videoView1);
this.mMediaController = new MediaController(this);
this.mVideo.setVideoURI(Uri.parse(this.mUri));
this.mVideo.setMediaController(mMediaController);
this.mMediaController.setAnchorView(this.mVideo);
this.mMediaController.requestFocus();
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Log.v("mplayer", ">>>create ok.");
}
@Override
public void onStart()
{
super.onStart();
this.mVideo.start();
}
public void onPause()
{
// Stop video when the activity is pause.
mPositionWhenPaused = this.mVideo.getCurrentPosition();
this.mVideo.stopPlayback();
super.onPause();
}
public void onResume()
{
// Resume video player
if(mPositionWhenPaused >= 0)
{
this.mVideo.seekTo(mPositionWhenPaused);
mPositionWhenPaused = -1;
}
super.onResume();
}
}
but i can't play the media and get the log in LogCat:
06-21 09:14:10.135: INFO/StagefrightPlayer(33):
setDataSource('/mnt/sdcard/mj.mp4')
06-21 09:14:12.043: INFO/ActivityManager(72): Displayed
hls.m3u/.HttpLiveStreaming: +34s147ms
06-21 09:14:15.133: DEBUG/MediaPlayer(5261): getMetadata
06-21 09:14:15.395: DEBUG/AudioSink(33): bufferCount (4) is too small and
increased to 12
06-21 09:14:15.613: ERROR/MediaPlayer(5261): error (1, -2147483648)
06-21 09:14:16.084: ERROR/MediaPlayer(5261): Attempt to call getDuration
without a valid mediaplayer
06-21 09:14:16.095: ERROR/MediaPlayer(5261): error (-38, 0)
06-21 09:14:16.166: ERROR/MediaPlayer(5261): Error (1,-2147483648)
06-21 09:14:16.194: DEBUG/VideoView(5261): Error: 1,-2147483648
06-21 09:14:16.754: DEBUG/dalvikvm(5261): GC_FOR_ALLOC freed 95K, 4% free
6422K/6663K, paused 158ms
06-21 09:14:16.773: INFO/dalvikvm-heap(5261): Grow heap (frag case) to
6.851MB for 513744-byte allocation
06-21 09:14:17.058: DEBUG/dalvikvm(5261): GC_CONCURRENT freed <1K, 4% free
6923K/7175K, paused 6ms+3ms
06-21 09:14:18.054: ERROR/MediaPlayer(5261): Error (-38,0)
06-21 09:14:18.054: DEBUG/VideoView(5261): Error: -38,0
and i recieve the force close window on vm screan.
can anybody tells me why and how to play the local media file on android vm?
thank you
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en