sync this.type with props.type

This commit is contained in:
dongyoungKo
2025-05-28 11:11:05 +09:00
parent 4ace34b9f0
commit a6f4cb8ab8
2 changed files with 7 additions and 5 deletions

View File

@@ -1485,11 +1485,14 @@ const VideoPlayerBase = class extends React.Component {
return;
}
this.type = this.props.type;
updatedState.currentTime =
this.type === "LIVE" ? this.state.currentLiveTimeSeconds : el.currentTime;
updatedState.duration =
this.type === "LIVE" ? this.state.liveTotalTime : el.duration;
//last time error : for youtube
if (this.props.isYoutube && ev.type === "onProgress") {
if (updatedState.duration - updatedState.currentTime < 1.0) {
@@ -2453,7 +2456,7 @@ const VideoPlayerBase = class extends React.Component {
<div
className={classNames(
css.fullscreen,
panelInfo.shptmBanrTpNm === "LIVE" && css.liveFullScreen
type === "LIVE" && css.liveFullScreen
)}
{...controlsAriaProps}
>
@@ -2495,9 +2498,7 @@ const VideoPlayerBase = class extends React.Component {
<Times
noCurrentTime
total={
panelInfo.shptmBanrTpNm === "LIVE"
? liveTotalTime
: this.state.duration
type === "LIVE" ? liveTotalTime : this.state.duration
}
formatter={durFmt}
type={type}
@@ -2507,7 +2508,7 @@ const VideoPlayerBase = class extends React.Component {
<Times
noTotalTime
current={
panelInfo.shptmBanrTpNm === "LIVE"
type === "LIVE"
? currentLiveTimeSeconds
: this.state.currentTime
}

View File

@@ -1927,6 +1927,7 @@ const PlayerPanel = ({
return panelInfo.shptmBanrTpNm;
}, [panelInfo.shptmBanrTpNm, playListInfo, selectedIndex]);
const clearTimer = useCallback(() => {
clearTimeout(timerId.current);
timerId.current = null;