[PlayerPanel] live time update
This commit is contained in:
@@ -18,11 +18,12 @@
|
||||
.currentTime {
|
||||
padding-right: 140px;
|
||||
}
|
||||
> * {
|
||||
display: inline-block;
|
||||
> span {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.separator {
|
||||
> * {
|
||||
color: #fff;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.enact-locale-rtl({
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user