Skip to the page
TACTILE UI

12.1Block 12.1 · Features

Pocket Player

A pocket cassette player for your recordings. PLAY latches down; STOP springs it back and, stopped, pops the door open on its spring. Choose a recording and it swaps the tape and plays.

Version
0.1.0
Size
100.9 KB gzipped
Access
With a Pass
Needs
pocket-player.mjs + pocket-player.css · Cassette
Tests
9 tests · 13 states
On this page
  1. Use it
  2. Options
  3. Methods
  4. States
  5. How it works
  6. Built with
01

Use it

The audio section of a product that keeps recordings: incident calls for an on-call or devtools product, standups and interviews for a meeting recorder, field notes for an IoT crew, episodes of a company podcast. The player is a real transport (PLAY, REW and FF latch, STOP releases and ejects) and choosing another recording plays out as a hand would do it, so the page explains itself. Give each recording a src and it plays the audio; without one it runs for its duration.

Copy the pocket-player folder and the cassette folder from its package next to your page, link the stylesheets and mount it on an element. Every option has a default; the lab’s Code tab writes the same example at any settings, and for React, Vue, Svelte or a custom element (Using a framework).

<link rel="stylesheet" href="cassette/cassette.css">
<link rel="stylesheet" href="pocket-player/pocket-player.css">
<div id="pocket-player"></div>

<script type="module">
  import Cassette from './cassette/cassette.mjs';
  import { mount } from './pocket-player/pocket-player.mjs';

  const pocketPlayer = mount(document.getElementById('pocket-player'), {
    eyebrow: 'Incident audio',
    heading: 'Every war room, on tape.',
    lede: 'Wardroom records the bridge call from the first page to the all-clear and files it with the timeline. Find the minute someone said “roll it back”, and hear it.',
  }, { Cassette });

  // pocketPlayer.update({ … });   change any option in place
  // pocketPlayer.destroy();        and take it away again
</script>
02

Options

OptionTypeDefaultWhat it does
eyebrowtext'Incident audio'Eyebrow
headingtext'Every war room, on tape.'Headline
ledetext'Wardroom records the bridge call from the first page to the all-clear and files it with the timeline. Find the minute someone said “roll it back”, and hear it.'Lead
tapenumber, 1 to 41Which recording is loaded when the page opens.
positionnumber, 0 to 10032Where that tape is when the page opens.
shellsmoke · clear · black · white'smoke'Cassette shell
hubswhite · brass · black'white'Hubs
modeltext'Wardroom PK-2'Printed on the player
listbooleantrueChoose one and the player stops, ejects, swaps the tape, shuts and plays.
finishauto · aluminium · graphite'auto'Auto follows the page’s data-finish, then the visitor’s system.
soundbooleanfalseSynthesised, no audio file: the keys latch and spring up, the door kicks out and thuds shut, fast wind whirs. Only after a press.
03

Methods

mount(element, options, { Cassette })
Builds the block inside the element and returns its handle. Hand it the Cassette it is built with.
handle.update(next = {})
Change options in place.
handle.state
handle.cassette
handle.destroy()
Stops it and cleans up after it.
04

States

  1. At restTape 1 in the player at 32 %, the door shut, all keys up, the lamp dark, the counter reading the position; nothing runs.
  2. PlayingPLAY latches part-way down; the lamp lights green; the counter runs; the cassette's hubs turn at tape speed and its packs follow.
  3. WindingFF or REW latch; the lamp is amber; the hubs spin at 14× (backwards for REW); the counter runs fast; at an end the key is thrown back up.
  4. StoppedSTOP springs every latched key back up past its rest; the lamp goes dark.
  5. EjectSTOP again: the door pops open on its spring past 24°, rocks and settles, its shadow deepening and its glass catching the lamp; the head and capstans show at the top of the bay.
  6. ShutSTOP again, a push on the door, or any running key: the door swings shut against its stop and the latch gives a little back.
  7. Choosing a recordingThe player stops, ejects, swaps the tape's title and length, winds to the start, shuts and plays; the list marks the tape in the player.
  8. ScrubbingTurn a hub on the cassette: the counter follows, and with audio the player seeks.
  9. AluminiumA bead-blasted aluminium body, face keys and a black contrast PLAY, a reflective LCD counter.
  10. GraphiteA soft-touch graphite body, light contrast PLAY, a vacuum-fluorescent counter.
  11. PhoneHead, player and list in one column; the player fills the width and every part scales with it.
  12. Off screen or hiddenThe loop pauses and resumes.
  13. Reduced motionThe door is open or shut at once, keys move without spring, the tape jumps; every state still shows.
05

How it works

Made of: Latching transport reducer, Sprung door hard stop, Auto stop, Eject swap shut sequence, Css 3d hinge, Container query layout, Object in deps, Media binding, Finish following, Sleeping loop.

Original composition. The product (Wardroom), its incidents and recordings are invented. The player is CSS drawn here around the Cassette object, which is handed in as deps.Cassette. Faces: Instrument Sans and Geist Mono, both the kit's own, SIL OFL 1.1.

06

Built with

Docs
Finish
Volume