...
|
...
|
@@ -27,6 +27,26 @@ const _formatTime = (timestamp, b) => { |
|
|
return startTime.format(`${date}${time}`);
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 根据 时长(秒) 返回 时长格式化后的 字符串 HH:mm:ss
|
|
|
*/
|
|
|
const _getHumanDuration = (duration) => {
|
|
|
duration = moment.duration(duration, 's');
|
|
|
let durationH = duration.hours();
|
|
|
let durationM = duration.minutes();
|
|
|
let durationS = duration.seconds();
|
|
|
|
|
|
duration = [durationH, durationM, durationS].map((item) => {
|
|
|
if (item < 10) {
|
|
|
return `0${item}`;
|
|
|
} else {
|
|
|
return String(item);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return `${duration[0]}:${duration[1]}:${duration[2]}`;
|
|
|
};
|
|
|
|
|
|
// 获取顶部bannel
|
|
|
let _getBannerData = () => {
|
|
|
return service.get('operations/api/v5/resource/get', {
|
...
|
...
|
@@ -132,20 +152,8 @@ const fetchReplayInfo = (videoID) => { |
|
|
d.humanTime = _formatTime(data.live_start_time * 1000);
|
|
|
d.video_src = d.url;
|
|
|
|
|
|
let durationH = parseInt(d.live_last_time / 3600, 10); // 1h =3600s
|
|
|
let durationM = parseInt((d.live_last_time - durationH * 3600) / 60, 10);
|
|
|
let duration = [durationH, durationM];
|
|
|
|
|
|
duration.forEach((val, index) => {
|
|
|
if (val < 10) {
|
|
|
duration[index] = `0${val}`;
|
|
|
} else {
|
|
|
duration[index] = '' + val;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 自定义数据
|
|
|
d.duration = `${duration[0]} : ${duration[1]}`;
|
|
|
d.duration = _getHumanDuration(d.live_end_time - d.live_start_time);
|
|
|
d.living = 3; // 重播 状态
|
|
|
d.canPlay = true;
|
|
|
d.atEnd = false;
|
...
|
...
|
@@ -172,36 +180,8 @@ const fetchLiveInfo = (roomID) => { |
|
|
d.humanTime = _formatTime(d.starting_time * 1000); // 预告 开始时间
|
|
|
d.video_src = d.hls_downstream_address;
|
|
|
|
|
|
let duration = moment.duration(d.live_last_time, 's');
|
|
|
let durationH = duration.hours();
|
|
|
let durationM = duration.minutes();
|
|
|
let durationS = duration.seconds();
|
|
|
|
|
|
duration = [durationH, durationM, durationS].map((item) => {
|
|
|
if (item < 10) {
|
|
|
return `0${item}`;
|
|
|
} else {
|
|
|
return String(item);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
// let durationH = parseInt(d.live_last_time / 3600, 10); // 1h =3600s
|
|
|
// let durationM = parseInt((d.live_last_time - durationH * 3600) / 60, 10);
|
|
|
// let duration = [durationH, durationM];
|
|
|
|
|
|
// duration.forEach((val, index) => {
|
|
|
// if (val < 10) {
|
|
|
// duration[index] = `0${val}`;
|
|
|
// } else {
|
|
|
// duration[index] = '' + val;
|
|
|
// }
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
// 自定义数据
|
|
|
d.duration = `${duration[0]}:${duration[1]}:${duration[2]}`;
|
|
|
d.duration = _getHumanDuration(d.live_last_time);
|
|
|
d.canPlay = d.living === 1;
|
|
|
d.notBegin = d.living === 0;
|
|
|
d.atEnd = d.living === 2;
|
...
|
...
|
|