-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modularize controls, and related changes/features #42
Conversation
…d babel plugin included.
…te -> seekComplete.
Holy Cow you have been busy @benwiley4000 . I've been out of the country for 2 days and there is a 2.0 release incoming, new changes. I am really happy this project is getting a volume bar and so many other changes. You sir deserve a medal 🥇. I read all the changes and this is going to be a major release indeed! |
The description has been updated to reflect the new features and breaking changes in this branch. There's still a good amount of work to do before a 2.0 alpha is ready, but the bulk of the code changes are here. |
Closes #36.
New features
Overview
AudioPlayer
.AudioPlayer
, which is accessible (and controllable where applicable) by control components - includingcurrentTime
,volume
,muted
,duration
,loop
,playbackRate
, and thebuffered
andplayed
TimeRanges
objects.New
AudioPlayer
propscontrols
: An array of strings, or components, or both - strings being keywords matching prebuilt control components, and components being custom control implementations. Each control component is rendered byAudioPlayer
and passed the full state, as well as theplaylist
, whether it's ok to seek (seekUnavailable
) and any unknown props passed to theAudioPlayer
instance.loadFirstTrackOnPlaylistComplete
: A boolean (default true) determining if the first track should be loaded up after the playlist concludes (whencycle
is false).pauseOnSeekPreview
: A boolean (default false) which will make audio playback stop while the user is dragging to seek a new location in the track.Note we'll be adding several more props for #40, #53 and #54.
New component exports
Controls
Spun-out components for all the controls already available in 1.x:
PlayPauseButton
BackSkipButton
ForwardSkipButton
AudioProgress
Spacer
(an invisible div for layout)We'll also be creating new components for #1, #53 and #54.
Helper components
ProgressBar
- generic range slider component useful for audio seeking, volume change, etc.ProgressBarDisplay
- the presentational component composed byProgressBar
- use this if you just want to display progress, not change it.PurePropTypesComponent
- a component which can be extended instead ofPureComponent
, in order to only update for changed props listed inpropTypes
(or for state changes) - helps avoid unnecessary renders for control components, which receive many props but only use a few on average.Breaking code changes
API
hideBackSkip
andhideForwardSkip
are gone. The new way to hide controls is thecontrols
prop. E.g.['playpause', 'progress']
, if that's all you want.CSS and layout
ProgressBarDisplay
component. Also, styles which seem anti-modular have been removed (width: 100%
is no longer automatically added to the outer element; it must be specified by the developer if desired).id
attributes were removed from DOM elements, so if you were using these in your styles, you'll need to switch to classes.pointer-events
property which is only supported in Internet Explorer since version 11. Pre-IE11 is about half a percent of internet users, but if you need to support them, you can try composingProgressBar
to build your own custom control.Behavior
Behavior should be mostly consistent - though it's hard to be sure without test coverage 😨 (#35).
cycle
is false. It feels weird to skip to the first track, and then the audio pauses. But that's going to change again (hopefully make a bit more sense) for Update cycle=false behavior #41.