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

View File

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