Skip to content

Commit

Permalink
fix: dont show Controller component when first frame is not ready (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyuhen authored Apr 18, 2019
1 parent be4d309 commit 5f3c621
Showing 1 changed file with 34 additions and 30 deletions.
64 changes: 34 additions & 30 deletions packages/griffith/src/components/Player/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,8 @@ class Player extends Component {
{title}
</div>
)}
{isPlaying && (
{/*首帧已加载完成时展示 MinimalTimeline 组件*/}
{isPlaying && (!isLoading || currentTime !== 0) && (
<div
className={css(
hiddenOrShownStyle.base,
Expand All @@ -506,35 +507,38 @@ class Player extends Component {
/>
</div>
)}
<div
className={css(
styles.controller,
hiddenOrShownStyle.base,
showController
? hiddenOrShownStyle.shown
: hiddenOrShownStyle.hidden
)}
onMouseEnter={this.handleControllerPointerEnter}
onMouseLeave={this.handleControllerPointerLeave}
>
<Controller
standalone={standalone}
isPlaying={isPlaying}
duration={duration}
currentTime={currentTime}
volume={volume}
buffered={bufferedTime}
isFullScreen={isFullScreen}
onDragStart={this.handleControllerDragStart}
onDragEnd={this.handleControllerDragEnd}
onPlay={this.handlePlay}
onPause={this.handlePause}
onSeek={this.handleSeek}
onVolumeChange={this.handleVideoVolumeChange}
onToggleFullScreen={this.handleToggleFullScreen}
show={showController}
/>
</div>
{/*首帧已加载完成时展示 Controller 组件*/}
{isPlaybackStarted && (!isLoading || currentTime !== 0) && (
<div
className={css(
styles.controller,
hiddenOrShownStyle.base,
showController
? hiddenOrShownStyle.shown
: hiddenOrShownStyle.hidden
)}
onMouseEnter={this.handleControllerPointerEnter}
onMouseLeave={this.handleControllerPointerLeave}
>
<Controller
standalone={standalone}
isPlaying={isPlaying}
duration={duration}
currentTime={currentTime}
volume={volume}
buffered={bufferedTime}
isFullScreen={isFullScreen}
onDragStart={this.handleControllerDragStart}
onDragEnd={this.handleControllerDragEnd}
onPlay={this.handlePlay}
onPause={this.handlePause}
onSeek={this.handleSeek}
onVolumeChange={this.handleVideoVolumeChange}
onToggleFullScreen={this.handleToggleFullScreen}
show={showController}
/>
</div>
)}
</div>
)}
{error && (
Expand Down

0 comments on commit 5f3c621

Please sign in to comment.