public void onCompletion(MediaPlayer arg0) { // TODO Auto-generated method stub MmpTool.LOG_DBG("play compeletion!"); if (mmediaplayer != null) { saveProgress(0); if (videopl.getShuffleMode(Const.FILTER_VIDEO) == Const.SHUFFLE_ON || videopl.getRepeatMode(Const.FILTER_VIDEO) == Const.REPEAT_NONE) { if (videopl.getCurrentIndex(Const.FILTER_VIDEO) >= ((videopl.getFileNum(Const.FILTER_VIDEO) - 1))) { try { isEnd = true; mmediaplayer.stop(); mPlayStatus = VideoConst.PLAY_STATUS_END; throw new Exception("End of PlayList!!!"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } try { autoNext(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } if (mOnPBCompleteListener != null) { mOnPBCompleteListener.onComplete(pb); } } }
/** manual next */ public void manualNext() throws IllegalStateException { if (mmediaplayer != null) { if (mplayerMode == VideoConst.PLAYER_MODE_HTTP) { MmpTool.LOG_ERROR("This player mode can't do next!"); throw new IllegalStateException("Can't do Next!!!"); } saveProgress(getProgress()); if (mPlayStatus != VideoConst.PLAY_STATUS_STOPPED) { try { mmediaplayer.stop(); } catch (IllegalStateException e) { e.printStackTrace(); throw new IllegalStateException(e); } mPlayStatus = VideoConst.PLAY_STATUS_STOPPED; } if (videopl.getShuffleMode(Const.FILTER_VIDEO) == Const.SHUFFLE_ON || videopl.getRepeatMode(Const.FILTER_VIDEO) == Const.REPEAT_NONE) { if (videopl.getCurrentIndex(Const.FILTER_VIDEO) >= (videopl.getFileNum(Const.FILTER_VIDEO) - 1)) { stop(); MmpTool.LOG_DBG("End of PlayList!"); throw new IllegalStateException("End of PlayList!!!"); } } mcurPath = videopl.getNext(Const.FILTER_VIDEO, Const.MANUALNEXT); MmpTool.LOG_DBG(mcurPath); mmediaplayer.reset(); mPlayStatus = VideoConst.PLAY_STATUS_END; try { setDataSource(mcurPath); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); throw new IllegalStateException(e); } try { play(); } catch (IllegalStateException e) { e.printStackTrace(); throw new IllegalStateException(e); } } }