本文整理汇总了Java中org.videolan.vlc.MediaWrapper.getLength方法的典型用法代码示例。如果您正苦于以下问题:Java MediaWrapper.getLength方法的具体用法?Java MediaWrapper.getLength怎么用?Java MediaWrapper.getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.videolan.vlc.MediaWrapper
的用法示例。
在下文中一共展示了MediaWrapper.getLength方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setOverlayProgress
import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
/**
* update the overlay
*/
private int setOverlayProgress() {
if (mService == null) {
return 0;
}
int time = (int) getTime();
int length = (int) mService.getLength();
if (length == 0) {
MediaWrapper media = MediaDatabase.getInstance().getMedia(mUri);
if (media != null)
length = (int) media.getLength();
}
// Update all view elements
mSeekbar.setMax(length);
mSeekbar.setProgress(time);
if (mSysTime != null)
mSysTime.setText(DateFormat.getTimeFormat(this).format(new Date(System.currentTimeMillis())));
if (time >= 0) mTime.setText(Strings.millisToString(time));
if (length >= 0) mLength.setText(mDisplayRemainingTime && length > 0
? "-" + '\u00A0' + Strings.millisToString(length - time)
: Strings.millisToString(length));
return time;
}
示例2: fillVideoView
import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
private void fillVideoView(ViewHolder holder, MediaWrapper media) {
/* Time / Duration */
if (media.getLength() > 0) {
long lastTime = media.getTime();
String text;
if (lastTime > 0) {
text = String.format("%s / %s",
Strings.millisToText(lastTime),
Strings.millisToText(media.getLength()));
holder.progress.setVisibility(View.VISIBLE);
holder.progress.setMax((int) (media.getLength() / 1000));
holder.progress.setProgress((int) (lastTime / 1000));
} else {
text = Strings.millisToText(media.getLength());
holder.progress.setVisibility(View.INVISIBLE);
}
holder.time.setText(text);
} else
holder.progress.setVisibility(View.INVISIBLE);
if (media.getWidth() > 0 && media.getHeight() > 0)
holder.resolution.setText(String.format("%dx%d", media.getWidth(), media.getHeight()));
else
holder.resolution.setText("");
holder.title.setText(media.getTitle());
holder.more.setVisibility(View.VISIBLE);
}
示例3: fillView
import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
private void fillView(ViewHolder holder, MediaWrapper media) {
boolean group;
String text = "";
String resolution = "";
int max = 0;
int progress = 0;
if (media.getType() == MediaWrapper.TYPE_GROUP) {
group = true;
MediaGroup mediaGroup = (MediaGroup) media;
int size = mediaGroup.size();
resolution = getContext().getResources().getQuantityString(R.plurals.videos_quantity, size, size);
} else {
group = false;
/* Time / Duration */
if (media.getLength() > 0) {
long lastTime = media.getTime();
if (lastTime > 0) {
text = String.format("%s / %s",
Strings.millisToText(lastTime),
Strings.millisToText(media.getLength()));
max = (int) (media.getLength() / 1000);
progress = (int) (lastTime / 1000);
} else {
text = Strings.millisToText(media.getLength());
}
}
if (media.getWidth() > 0 && media.getHeight() > 0)
resolution = String.format("%dx%d", media.getWidth(), media.getHeight());
}
holder.binding.setVariable(BR.group, group);
holder.binding.setVariable(BR.resolution, resolution);
holder.binding.setVariable(BR.time, text);
holder.binding.setVariable(BR.max, max);
holder.binding.setVariable(BR.progress, progress);
}
示例4: compare
import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
@Override
public int compare(MediaWrapper m1, MediaWrapper m2) {
if(m1.getLength() > m2.getLength()) return -1;
if(m1.getLength() < m2.getLength()) return 1;
else return 0;
}