• Stars
    star
    183
  • Rank 205,690 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

đŸ“ŧ A flexible media player component library for React that requires no up-front config

Please note that open-source maintenance is not my main focus at the moment.

I will not be investing significant effort in the very near future to review and address issues on this repository. However I do want my software to be useable!

If you have an issue that must be resolved for your work, please open a pull request to fix it, and send me a direct email to make sure that I see it. I ignore most messages from GitHub these days.

I'm also happy to help out if you have a question about how to use the library.

My email can be found at the top of this commit.

Keep in mind that I have a full-time job and a personal life as well as other hobbies that have taken priority over open source, so I might not respond immediately. But don't hesitate to follow up after a few days if you think I've missed your email.

Cassette

https://www.pexels.com/photo/black-lx90-cassette-tape-1228497/

Cassette is a zero-config-required media player component library for React. The default responsive UI works great in desktop or mobile web browsers. The flexible core handles the logical complexities of common audio and video player paradigms, while allowing you to implement any UI you can come up with.

This is Cassette v2, which is in beta.

See version 1 (also known as react-responsive-audio-player) here!

Cassette is split into four packages

  • @cassette/core provides React Context-based components which expose an API for consuming and updating media player state
  • @cassette/components contains some convenient React component building blocks which can be used in media player user interfaces created with @cassette/core
  • @cassette/player provides a responsive, zero-config-needed React media player component, implemented with @cassette/core
  • @cassette/hooks provides optional React Hooks for consuming media player state

See full documentation (with integrated live demos) here

Watch a talk introducing Cassette here

⚠ī¸ Note on installation

If you wanted to install, for instance, the @cassette/core and @cassette/player packages, you would run:

npm install @cassette/core @cassette/player

I do not control, nor do I have any contact with the owner of, the npm package called cassette (without the @). If you npm install cassette, you will be using the wrong library! However it turns out this package is used for managing playlist data. So if you really want to confuse the other devs on your team, you can try using cassette and @cassette together!

If you're not using npm and you need production-ready scripts to include in your project, check out the releases. You can also look on unpkg, e.g. here.

đŸ“ŧ Cassette in the wild đŸ“ŧ

What can you build with Cassette? Here are some examples:

rexmort.us

A site showcasing creative content, including several podcast series which can be listened to while navigating the rest of the site.

How is Cassette used?

The MediaPlayerControls UI from the @cassette/player package can be seen at the bottom of the page, featuring the included play/pause, mute toggle, and media progress controls (with some custom CSS styles applied). PlayerContextProvider wraps the whole page, and is used on each of the podcast pages where we can select a podcast to play, and see an indication of which podcast is playing currently.

OwlTail

A web app where users can explore curated popular podcasts and schedule queues of podcasts to listen to in the browser.

How is Cassette used?

Instead of using Cassette's default UI, OwlTail's player UI is all custom-built. It relies on a page-level PlayerContextProvider to provide media data and functionality. The control UI at the bottom of the screen features some controls which don't even exist in the default Cassette UI, like a playback rate control, and buttons for skipping back and forward by 30 second intervals; even though Cassette doesn't provide this UI, its callbacks make it simple to implement this sort of behavior. The progress bar, although featuring custom UI, relies on the MediaProgressBar helper from the @cassette/components package, which is designed to work well with both mouse and touch devices.

The UI in the rest of the app is synced with the player via the PlayerContextProvider wrapper, so that the currently-playing podcast will always display as such when encountered in the queue or a podcast listing.

Win95 Media Player

A React component which is a clone of the Media Player application that shipped with Windows 95. It supports video and audio playback.

How is Cassette used?

Although the UI is totally different than what ships with Cassette, all the media playback internals are handled by Cassette. This means you can configure it the same way you would configure the MediaPlayer component from @cassette/player. The website features a video playlist and an audio playlist, and PlayerContextGroup from @cassette/core is used to prevent both audio from both pieces of media from playing simultaneously.

benwiley.org

A personal site featuring a portfolio of work, including some video game soundtrack pieces, which can be sampled while browsing the rest of the site's content.

How is Cassette used?

This site uses @cassette/player's PlayPauseButton and ForwardSkipButton components, while wrapping the MediaProgressBar helper from @cassette/components for a custom progress navigation UI. Because the PlayerContextProvider wraps the whole page, we can integrate playback controls inline on the music portfolio page, dynamically displaying a media progress control below the description for the currently-selected track.

Development

For building and testing instructions, see CONTRIBUTING.md.

Acknowledgements

Thanks to BrowserStack for providing their platform free of charge for this project (and many other open source projects). We're using BrowserStack to test compatibility across multiple browsers and platforms.

BrowserStack Logo

Icons

The standard control components make use of icons from various sources.

The CSS YouTube-style play/pause button and the skip button were authored in part by @benwiley4000, with heavy assistance from this CodePen by @OxyDesign.

The SVG repeat, shuffle, fullscreen and volume icons come from Google's material-design-icons.

More Repositories

1

gif-frames

đŸ–ŧ Extract frames from an animated GIF with pure JS
JavaScript
165
star
2

react-gif-player

đŸ“Ŋ A GIF component that moves when YOU want it to!
JavaScript
93
star
3

win95-media-player

đŸ’ŋ Back from 1995, and running on your website
JavaScript
64
star
4

youtube-vtt

â–ļī¸ Extract and save WebVTT closed caption tracks from YouTube videos
JavaScript
46
star
5

pico8-gpio-listener

🎙ī¸đŸ•šī¸ Listen to changes to your PICO-8 game's GPIO pins
JavaScript
41
star
6

react-dot-fragment

đŸĻ„ Use React 16's <React.Fragment> in React 15
JavaScript
21
star
7

hypergit

📡 Decentralizing the pull request
21
star
8

pico8-table-string

Store a nested Lua data table as one giant string
Lua
15
star
9

pico8-messenger

đŸ’Ŧ Helps you help PICO-8 talk to things
JavaScript
14
star
10

pico8-responsive-webplayer-transform

🕹 Responsive post-processing for #pico8 web player
Python
14
star
11

vtt-translate

🔇 🉑ī¸ Google Translate your .vtt subtitle files into other languages
JavaScript
13
star
12

pico8-to-lua

Converts PICO-8 extended Lua syntax to standard Lua syntax
Lua
11
star
13

volca-sampler

Send a new sound to your volca sample!
JavaScript
11
star
14

dat-pkg

Draft specification of a decentralized package registry and manager based on the Dat protocol
9
star
15

tiny-pico8-touch-ui

👾👌 Add touch controls to your PICO-8 game - no sweat!
JavaScript
8
star
16

steam-party-planner

🎮 💃 Compare Steam libraries with your friends
JavaScript
4
star
17

calorie_tracker_backbone

A personal food/calorie tracker using the Nutritionix API, built with Backbone.js
JavaScript
3
star
18

simple-audio-streaming-app

A web app which serves specified mp3 directories from the host machine.
JavaScript
3
star
19

react-extra-prop-types

Extra PropTypes for use with React components
JavaScript
3
star
20

3dbuzz-archiver

JavaScript
2
star
21

recursive-json-key-transform

Apply a string transformation recursively to all keys in a JSON-compatible object.
JavaScript
2
star
22

bind-cache

➰ Bound method cache, ideal for React
JavaScript
2
star
23

github-pull-requests

Fetches recent pull requests initiated by a given GitHub user, with optional filters.
JavaScript
2
star
24

redux-action-transform-middleware

Apply a transformation to a specified target on a Redux action, if that target exists.
JavaScript
2
star
25

cassette-demo-app

For js-montreal/forwardjs ottawa
JavaScript
1
star
26

wildcard-export-override-example

JavaScript
1
star
27

volca-sampler-plugins

Plugins for https://volcasampler.com
JavaScript
1
star
28

jazzerbot

🎷 User-Customized Jazz Improvisation Generation
Java
1
star
29

ant-swarm-net-load-balancing

Using "ants" to solve network traffic problems... the hard way
TeX
1
star
30

benwiley.org

http://benwiley.org
JavaScript
1
star
31

incognitobook

đŸ•ĩī¸â€â™€ī¸ Browser extension to open all external Facebook links in an Incognito window.
JavaScript
1
star
32

recursive-lowercase-json

Small function recursively converts object keys to lowercase within JSON-compatible object.
JavaScript
1
star
33

string-length-the-hard-way

What if you wanted to get the length of a string in Lua.. the hard way?
1
star
34

hello-modules

A simple working usage of static and dynamic ES2015 imports, working in Safari Technology Preview.
JavaScript
1
star
35

why-bind-cache

A presentation on using a cache for bound functions in React
JavaScript
1
star
36

2019.benwiley.org

JavaScript
1
star