码迷,mamicode.com
首页 > 其他好文 > 详细

1600802095

时间:2018-12-12 00:30:43      阅读:125      评论:0      收藏:0      [点我收藏+]

标签:span   eset   img   cat   cli   title   分享图片   tool   copy   

一.界面

技术分享图片

 

二.关键代码

 public void play() {
          try {
              player.reset();
              String dataSource = musicList.get(songNum);//获得播放音乐的路径
              setPlayName(dataSource);
              player.setAudioStreamType(AudioManager.STREAM_MUSIC);
              player.setDataSource(dataSource);
              player.prepare();
              player.start();
              //setOnCompletionListener 
              player.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
                  public void onCompletion(MediaPlayer arg0) {
                      next();
                  }
              });
  
          } catch (Exception e) {
              Log.v("MusicService", e.getMessage());
          }
      }
技术分享图片

三.链接

https://git.coding.net/bestimbalance/Mediaplayer.git

1600802095

标签:span   eset   img   cat   cli   title   分享图片   tool   copy   

原文地址:https://www.cnblogs.com/TF2095/p/10105219.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!