alexanderwallin / react-player-controls

⏯ Dumb and (re)useful React components for media players.
http://alexanderwallin.github.io/react-player-controls/
ISC License
191 stars 35 forks source link

Provide a loading state icon/component in <PlaybackControls /> #14

Closed alexanderwallin closed 6 years ago

alexanderwallin commented 8 years ago

There's that awkward moment after playing a stream or otherwise not preloaded resource where you want to indicate a loading state. If you do it nicely, you should be able to pause a non-ready resource. But for us mere mortals, a presentation-only loading indicator component would come in handy.

Something like:

// New prop types:
{
  isLoading: PropTypes.bool,
  loadingComponent: PropTypes.oneOfType([
    PropTypes.node,
    PropTypes.func,
  ]),
}

// New default props:
{
  isLoading: false,
  loadingComponent: null,
}

Which you would implement like:

<PlaybackControls
  {...props}
  isLoading={playbackState === PLAYING && isLoadingMedia}
  loadingComponent={() => <Spinner />}
/>
alexanderwallin commented 6 years ago

Obsolete as of 1.0.0