通过setVideoURI播放视频
protected VideoView mine;?
? ? protected boolean done = false;?
?
? ? /** Called when the activity is first created. */?
? ? @Override?
? ? public void onCreate(Bundle savedInstanceState) {?
? ? ? ? super.onCreate(savedInstanceState);?
? ? ? ? setContentView(R.layout.videoshow); ??
? ? ? ? mine = (VideoView) findViewById(R.id.video); ? // Save the VideoView for touch event processing ?
? ? ? ? try {?
? ? ? ? ? ? String myURI = "/sdcard/" + path + "/v/" ?
? ? ? ? ? ? ? ? ? ? ? ? ? + currentItem.getFile() ?
? ? ? ? ? ? ? ? ? ? ? ? ? + "." + currentItem.getFileType();?
? ? ? ? ? ? Uri video = Uri.parse(myURI); ?
? ? ? ? ? ? mine.setVideoURI(video);?
? ? ? ? ? ? mine.start();?
? ? ? ? ? ? mine.setOnCompletionListener(new OnCompletionListener() {?
?
? ? ? ? ? ? ? ? public void onCompletion(MediaPlayer mp) { ??
? ? ? ? ? ? ? ? ? ? result.putExtra("com.ejf.convincer01.Finished", true);?
? ? ? ? ? ? ? ? ? ? done = true;?
? ? ? ? ? ? ? ? }?
? ? ? ? ? ? });?
? ? ? ? } catch (Exception ex) {?
? ? ? ? ? ? Log.d(DEBUG_TAG, "Video failed: '" + ex + "'" );?
? ? ? ? }?