Version 1.0.0 - Frontend
This commit is contained in:
@@ -29,6 +29,40 @@ export function getReadableDuration(duration) {
|
||||
return max
|
||||
}
|
||||
|
||||
// Get hh:mm:ss format
|
||||
|
||||
export function getVideoDuration(duration) {
|
||||
var max = ""
|
||||
duration *= 1000;
|
||||
|
||||
const maxhours = Math.floor(duration / 3600000);
|
||||
|
||||
var maxmin = Math.trunc(duration / 60000) - (Math.floor(duration / 60000 / 60) * 60);
|
||||
var maxsec = Math.floor(duration / 1000) - (Math.floor(duration / 1000 / 60) * 60);
|
||||
|
||||
|
||||
if (maxsec < 10) {
|
||||
maxsec = `0${maxsec}`;
|
||||
}
|
||||
|
||||
|
||||
if(maxhours != 0) {
|
||||
|
||||
if (maxmin < 10) {
|
||||
maxmin = `0${maxmin}`;
|
||||
}
|
||||
|
||||
|
||||
max = maxhours + ":" + maxmin + ":" + maxsec
|
||||
} else {
|
||||
max = maxmin + ":" + maxsec
|
||||
|
||||
}
|
||||
|
||||
return max
|
||||
|
||||
}
|
||||
|
||||
export function getSecondsDuration(duration) {
|
||||
// Duration is in format hh:mm:ss and can be just m:ss or mm:ss
|
||||
var durationArray = duration.split(":");
|
||||
@@ -41,4 +75,5 @@ export function getSecondsDuration(duration) {
|
||||
seconds = parseInt(durationArray[0]);
|
||||
}
|
||||
return seconds;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user