"00:00:10"
"00:00:06"
"00:10"если в минутах
"10:40"и если в часах уже вот так как сейчас
"00:00:10"
const a = 'https://www.w3schools.com/html/mov_bbb.mp4';
const b = 'https://assets.codepen.io/6093409/hubspot-video-example.mp4';
const arr = [a, b];
arr.map((item) => {
let media = new Audio(item);
media.onloadedmetadata = function () {
console.log(new Date(media.duration * 1000).toISOString().slice(11, 19));
};
});
arr.map((item) => {
let media = new Audio(item);
media.onloadedmetadata = function () {
let ac = new Date(media.duration * 1000);
const hours = ac.getUTCHours();
if (hours == 0){
console.log(ac.toISOString().slice(14, 19))
} else {
console.log(ac.toISOString().slice(11, 19))
}
};
});
const a = 'https://www.w3schools.com/html/mov_bbb.mp4';
const b = 'https://assets.codepen.io/6093409/hubspot-video-example.mp4';
const arr = [a, b];
arr.map((item) => {
let media = new Audio(item);
media.onloadedmetadata = function () {
let date = new Date(this.duration * 1000);
let h = date.getUTCHours();
h = h ? h + ':' : '';
let m = date.getMinutes();
let s = date.getSeconds();
console.log(h + m + ':' + s);
};
});