public void prepare() throws IOException { if (mVideoResources.size() <= 0) return; VideoResource first = mVideoResources.get(0); mTagsContainer.setVideoTags(first.getVideoTags()); mActiveMediaPlayer.setDataSource(getContext(), first.getVideoUri()); mActiveMediaPlayer.prepare(); }
@Override public void onCompletion(MediaPlayer mediaPlayer) { Log.i("[OPV]", "mp complete"); if (mVideoIndex < mVideoResources.size() - 1) { mVideoIndex++; } else { mVideoIndex = 0; } Log.i("[OPV]", "next video index: " + mVideoIndex); VideoResource vr = mVideoResources.get(mVideoIndex); mActiveMediaPlayer.reset(); try { mActiveMediaPlayer.setDataSource(getContext(), vr.getVideoUri()); } catch (IOException e) { Log.i("[OPV]", "media player set data source failed"); e.printStackTrace(); } try { mActiveMediaPlayer.prepare(); } catch (IOException e) { Log.i("[OPV]", "media player prepare failed"); e.printStackTrace(); } mTagsContainer.setVideoTags(mVideoResources.get(mVideoIndex).getVideoTags()); mTagsContainer.showTags(); if (mVideoIndex != 0) { mActiveMediaPlayer.start(); } if (mShowPlayBtn && mVideoIndex == 0) { mPlayBtn.setVisibility(View.VISIBLE); } }
public void setTagEditable(boolean mTagEditable) { mTagsContainer.setEditable(mTagEditable); }
public boolean isTagEditable() { return mTagsContainer.isEditable(); }
public void setShowTags(boolean showTags) { mTagsContainer.setShowTags(showTags); }
public void addVideoTag(VideoTag tag) { mTagsContainer.addTag(tag); }
public boolean isShowTags() { return mTagsContainer.isShowTags(); }