안녕하세요:) 개발자 우디입니다! 아래 내용 관련하여 작업 중이신 분들께 도움이되길 바라며 글을 공유하니 참고 부탁드립니다😊
(이번에 벨로그로 이사오면서 예전 글을 옮겨적었습니다. 이 점 양해 부탁드립니다!)
onFullScreenIconClick = () => {
if (!this.context.api.isVideoLoaded()) return;
if (document.fullscreenElement) {
this.setState(
{
isFullScreen: false,
},
() => {
document.exitFullscreen();
},
);
} else {
this.setState(
{
isFullScreen: true,
},
() => {
this.videoFixedAspectRatioWrapperRef.current.requestFullscreen();
},
);
}
};
<div className="fullScreenControl">
<img
src={this.state.isFullScreen ? fullScreenExitIcon : fullScreenIcon}
alt="fullScreenIcon"
className="fullScreenIcon"
onClick={this.onFullScreenIconClick}
/>
</div>