Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@cassette/core
Advanced tools
A simple, clean, and responsive visual wrapper for the HTML audio tag, built with React.
@cassette/core
provides React Context-based components which expose an API for consuming and updating media player state. The API abstraction maps very closely to the set of actions that would be available to an end user of a conventional media player, while remaining flexible enough to accommodate varying media player design paradigms.
npm install @cassette/core
FullscreenContextConsumer
- used to read and update the state of the surrounding fullscreenContext
FullscreenContextProvider
- wraps an area which should be fullscreen-ablePlayerContextConsumer
- used to read and update the state of the surrounding playerContext
PlayerContextGroup
- a wrapper which can be used to share configuration among multiple descendant PlayerContextProvider
instances as well as prevent multiple media elements from playing audio simultaneouslyPlayerContextProvider
- wraps an area which shares a common playerContext
playerContextFilter
- consumes the surrounding fullscreenContext
and playerContext
and passes only a specified subset of the context, as well as any additional props, to the given child component[v2.0.0-beta.4] - 2019-09-26
v2 is a huge update! And yes, there are breaking changes. If you're just trying to upgrade from v1, you can check the Changed and Removed sections.
These notes are on changes since the previous stable release (v1.5.0). For changes that have occurred between alpha/beta releases, check the release notes.
All updates are mentioned on a broad level, but it wouldn't make sense to explain all new and changed APIs in minute detail here, so be sure to read the docs.
@cassette/player
package.
AudioPlayer
). AudioPlayer
has been renamed to MediaPlayer
and is a named export from @cassette/player
. So anything that previously looked like import AudioPlayer from 'react-responsive-audio-player'
will become import { MediaPlayer } from '@cassette/player'
.MediaPlayer
is the combination of two components: MediaPlayerControls
from the @cassette/player
package and PlayerContextProvider
(#214) from the @cassette/core
package. MediaPlayer
doesn't accept any unique props of its own, but rather all the props accepted by MediaPlayerControls
and PlayerContextProvider
. Discussion of prop changes or additions since v1 in this changelog section pertain to one of those two components.audioElementRef
prop to PlayerContextProvider
/MediaPlayer
has been renamed mediaElementRef
(#284)@cassette/player
(#397)currentTime
immediately instead of waiting until the user releases the mouse. (#204)cycle
prop is false
, no longer works - the action will be ignored and playback will continue. (#68)duration
property on your tracks! (#372)stalled
event fires (#166)src
to something that isn't in the playlist, it will now be reset automatically to the previous state (#178)isUnboundedStream
property should be set on track objects that are indeed unbounded streams (e.g. radio) since one of our fixes means retrying media fetches that yield Infinity
duration. Setting isUnboundedStream
to true
skips the refetch. (#373)onMediaEvent
prop is removed, since most of its use cases can be solved better now by using the PlayerContextProvider
(#226)
mediaElementRef
(previously called audioElementRef
(#284)) still exists as an escape hatchcycle
prop was removed. Use defaultRepeatStrategy
instead, and any subsequent updates should be set via playerContext
(since we would expect this setting to be changed as a result of an end user action) (#79)style
prop to AudioPlayer
(now MediaPlayer
) is no longer accepted. Use styles on a container element, or CSS, instead.displayText
property on a playlist track is removed in favor of the artist
and title
properties (also used by Media Session API) (#148).
getDisplayText
prop to MediaPlayer
/MediaPlayerControls
.hideBackSkip
, hideForwardSkip
and disableSeek
props from AudioPlayer
in v1.x.x are not available on MediaPlayer
/MediaPlayerControls
. Use the controls
prop instead, which is more flexible.@cassette/core
package, there is a @cassette/hooks
package for those who prefer to work with React hooks (#361)PlayerContextGroup
can wrap multiple PlayerContextProvider
/MediaPlayer
instances to share configuration and prevent simultaneous audio playback (#219)@cassette/player
: volume (#72), mute (#257), repeat (#79), shuffle (#87), read-only progress (#60), fullscreen (#221)ProgressBar
, ProgressBarDisplay
, MaybeMarquee
(#245), VideoDisplay
) available from @cassette/components
package (#292)controls
prop functionality for MediaPlayerControls
/MediaPlayer
- previously in v1 controls
supported a few control types as keywords, but in v2 several more built-in control keywords are supported, and custom controls can be implemented by passing in a function as a member of the controls
array (#42)PlayerContextProvider
, which can also be passed to MediaPlayer
:
initialStateSnapshot
and onStateSnapshot
can be used to persist media player state and restore at load time later (#226)loadFirstTrackOnPlaylistComplete
can be set false
to prevent a playlist from resetting on the first track when the playlist finishes (#42)defaultVolume
, defaultMuted
, defaultPlaybackRate
, startingTrackIndex
(#61)defaultRepeatStrategy
(#79)maintainPlaybackRate
- can be set true
in order to override the default browser behavior which resets the playback rate on every new track (#129)seekMode
- for specifying whether to pause, seek immediately, or continue playback and seek after release, when seeking with a progress bar (#204)onActiveTrackUpdate
callback prop (#76, #406)onTrackPlaybackFailure
callback prop (#356)onTimeUpdate
callback prop (#369)duration
property supported on playlist track objects so the player can display nicely before media has finished loading (#372)@cassette/player
exports components for individual player controls now (#42, #231, #341)@cassette/player
, in case you want to include only a subset of CSS you know you'll use. (#42) (#73, #231)trackIndex
can now be passed to a play/pause button in order to tie that button to a particular track in the playlist (#338)durationOverride
can be set on a media progress bar if you're running a live stream or similar and have stream duration info that isn't available to the media element (#379)title
attribute is now set, and configurable, for system notifcation support on iOS (#344)startingTime
property on a track object if you need to restore currentTime
from some previously recorded state (advanced use case) (#369)HTMLMediaElement
implementation (#349)undefined
crossOrigin
prop in Microsoft Edge (#368)isUnboundedStream
property on a playlist track if it is indeed an unbounded streamFAQs
A simple, clean, and responsive visual wrapper for the HTML audio tag, built with React.
The npm package @cassette/core receives a total of 3 weekly downloads. As such, @cassette/core popularity was classified as not popular.
We found that @cassette/core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.