[PlayerPanel] live time update

This commit is contained in:
고동영
2024-05-14 14:54:53 +09:00
parent e7df90f7df
commit 32cc7b6dbe
3 changed files with 27 additions and 5 deletions

View File

@@ -18,11 +18,12 @@
.currentTime {
padding-right: 140px;
}
> * {
display: inline-block;
> span {
margin-right: 10px;
}
.separator {
> * {
color: #fff;
display: inline-block;
}
.enact-locale-rtl({

View File

@@ -2074,6 +2074,7 @@ const VideoPlayerBase = class extends React.Component {
setSideContentsVisible,
disclaimer,
liveTimeSeconds,
currentLiveTimeSeconds,
...mediaProps
} = this.props;
@@ -2261,7 +2262,11 @@ const VideoPlayerBase = class extends React.Component {
{this.state.mediaSliderVisible ? (
<Times
noTotalTime
current={this.state.currentTime}
current={
type === "LIVE"
? currentLiveTimeSeconds + this.state.currentTime
: this.state.currentTime
}
formatter={durFmt}
/>
) : null}

View File

@@ -306,6 +306,21 @@ const PlayerPanel = ({
}
}, [playListInfo, selectedIndex, panelInfo.shptmBanrTpNm]);
const currentLiveTimeSeconds = useMemo(() => {
if (playListInfo && panelInfo?.shptmBanrTpNm === "LIVE") {
const today = new Date();
const startDtMoment = new Date(playListInfo[selectedIndex].strtDt);
const currentLiveTimeSeconds = Math.floor((today - startDtMoment) / 1000);
// const currentLiveTimeSeconds ;
return currentLiveTimeSeconds;
}
}, [playListInfo, selectedIndex]);
console.log("#currentLiveTimeSeconds", currentLiveTimeSeconds);
useEffect(() => {
if (!isActive) {
unableToPlay.start(toastUnableToPlay);
@@ -489,6 +504,7 @@ const PlayerPanel = ({
: Media
}
liveTimeSeconds={liveTimeSeconds}
currentLiveTimeSeconds={currentLiveTimeSeconds}
// VideoOverlay props
type={panelInfo?.shptmBanrTpNm}
panelInfo={panelInfo}