opt videoplayer

This commit is contained in:
lixiaopeng
2021-11-03 18:33:34 +08:00
parent f5f7cc6c9c
commit fe4bcbe2d8
13 changed files with 524 additions and 56 deletions

View File

@@ -0,0 +1,30 @@
package com.mogo.eagle.core.utilcode.util;
import java.util.Formatter;
import java.util.Locale;
/**
* author: lixiaopeng
* desc : 时间转换
*/
public final class TimeTransformUtils {
public static String stringForTime(int timeMs) {
if (timeMs <= 0 || timeMs >= 24 * 60 * 60 * 1000) {
return "00:00";
}
int totalSeconds = timeMs / 1000;
int seconds = totalSeconds % 60;
int minutes = (totalSeconds / 60) % 60;
int hours = totalSeconds / 3600;
StringBuilder stringBuilder = new StringBuilder();
Formatter mFormatter = new Formatter(stringBuilder, Locale.getDefault());
if (hours > 0) {
return mFormatter.format("%d:%02d:%02d", hours, minutes, seconds).toString();
} else {
return mFormatter.format("%02d:%02d", minutes, seconds).toString();
}
}
}