Skip to content

Commit

Permalink
add AudioPlayer
Browse files Browse the repository at this point in the history
Adds an `AudioPlayer` component that uses https://wavesurfer.xyz behind the scenes.
  • Loading branch information
sndrs committed Oct 14, 2024
1 parent eda6c16 commit 20357f7
Show file tree
Hide file tree
Showing 5 changed files with 563 additions and 19 deletions.
2 changes: 2 additions & 0 deletions dotcom-rendering/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"@types/webpack-env": "1.18.5",
"@types/webpack-node-externals": "3.0.4",
"@types/youtube": "0.0.50",
"@wavesurfer/react": "1.0.7",
"ajv": "8.17.1",
"ajv-formats": "2.1.1",
"amphtml-validator": "1.0.35",
Expand Down Expand Up @@ -190,6 +191,7 @@
"typescript-json-schema": "0.64.0",
"unified": "11.0.5",
"valibot": "0.28.1",
"wavesurfer.js": "7.8.6",
"web-vitals": "4.2.3",
"webpack": "5.94.0",
"webpack-assets-manifest": "5.2.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { Meta, StoryObj } from '@storybook/react';
import { defaultFormats } from '../../../.storybook/decorators/splitThemeDecorator';
import { allModes } from '../../../.storybook/modes';
import { AudioPlayer as Player } from './AudioPlayer';
import { audioBlob } from './stories/audio-blob';

const meta = {
title: 'Components/Audio Player',
component: Player,
} satisfies Meta<typeof Player>;

export default meta;

type Story = StoryObj<typeof meta>;

export const AudioPlayer = {
args: {
src: audioBlob,
// src: 'https://audio.guim.co.uk/2024/09/23-66750-gnl.sci.20240923.eb.blue_zone_new.mp3',
},
parameters: {
// We only want to snapshot the `multipleFormats` version below.
chromatic: { disable: true },
},
} satisfies Story;

export const MultipleFormats = {
args: AudioPlayer.args,
parameters: {
formats: defaultFormats,
chromatic: {
modes: {
horizontal: allModes.splitHorizontal,
},
},
},
} satisfies Story;
Loading

0 comments on commit 20357f7

Please sign in to comment.