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 preview */ public void manualPrev() throws IllegalStateException { if (mmediaplayer != null) { if (mplayerMode == VideoConst.PLAYER_MODE_HTTP) { throw new IllegalStateException("Can't do Prev!!!"); } if (videopl.getShuffleMode(Const.FILTER_VIDEO) == Const.SHUFFLE_ON || videopl.getRepeatMode(Const.FILTER_VIDEO) == Const.REPEAT_NONE) { if (videopl.getCurrentIndex(Const.FILTER_VIDEO) == 0) { throw new IllegalStateException("head of PlayList!!!"); } } 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; } mcurPath = videopl.getNext(Const.FILTER_VIDEO, Const.MANUALPRE); if (mcurPath == null) { MmpTool.LOG_DBG("End of PlayList!"); stop(); } 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); } } }