先看代码: 
try { 
String path = "/sdcard/t.mp3"; 
MediaPlayer mp = null; 
mp = new MediaPlayer(); 
mp.setDataSource(path); 
mp.prepare(); 
mp.start(); 
mp.setOnCompletionListener(cl); 
} catch (IllegalArgumentException e) { 
e.printStackTrace(); 
} catch (IllegalStateException e) { 
e.printStackTrace(); 
} catch (IOException e) { 
e.printStackTrace(); 

音频播放,就是这么简单。 
视频播放用VideoView,也不是很复杂。 

我还是把代码加上吧,不然老感觉不完整。 
VideoView videoView = new VideoView(this); 
setContentView(videoView); 
videoView.setVideoURI(Uri.parse("/sdcard/t.3gp")); 
videoView.requestFocus(); 
videoView.start(); 

相关文章:

  • 2021-10-18
  • 2022-12-23
  • 2021-04-11
  • 2022-02-06
  • 2021-07-24
  • 2021-05-18
猜你喜欢
  • 2021-11-30
  • 2022-03-04
  • 2022-12-23
  • 2021-11-17
  • 2022-01-10
  • 2021-07-05
  • 2021-05-22
相关资源
相似解决方案