Skip to content

feat: media player components#1097

Open
ethanwinters wants to merge 1 commit intocarbon-design-system:mainfrom
ethanwinters:media-player-components
Open

feat: media player components#1097
ethanwinters wants to merge 1 commit intocarbon-design-system:mainfrom
ethanwinters:media-player-components

Conversation

@ethanwinters
Copy link
Copy Markdown
Contributor

@ethanwinters ethanwinters commented Mar 18, 2026

Closes #350

Add standalone audio and video player components with multi-provider support

Changelog

New

  • Added audio-player web component with support for native audio, SoundCloud URLs, and transcript display
  • Added video-player web component with support for native video, YouTube, Vimeo, and Kaltura providers
  • Added transcript web component for displaying audio transcripts
  • Added React wrappers for audio-player, video-player, and transcript components
  • Added comprehensive Storybook documentation for all new components (both web component and React versions)
  • Added provider-based architecture with base provider class and platform-specific implementations
  • Added URL detection utilities for automatic provider selection based on media URLs
  • Added shared script loader utility for loading external player SDKs (YouTube, Vimeo, etc.)
  • Added LICENSE-react-player attribution files for components inspired by react-player
  • Added specific demo commands for testing individual media providers

Changed

  • Refactored MediaPlayer.tsx to use new audio-player and video-player components instead of react-player
  • Updated AudioComponent.tsx to integrate with new audio player component
  • Simplified MediaPlayer implementation by removing react-player dependency (354 lines reduced to cleaner implementation)
  • Updated demo audio/video examples with provider-specific commands
  • Updated test configurations across examples to improve test environment setup
  • Added new language strings for media player controls and accessibility

Removed

  • Removed react-player dependency from package.json
  • Removed test helper code that is no longer needed
  • Cleaned up unused imports in MessageTypeComponent

Testing / Reviewing

Storybook Testing:

  1. Run npm run storybook in the packages/ai-chat-components directory
  2. Navigate to "Components/Audio Player" section:
    • Test the Web Component stories with different audio sources (native audio files, SoundCloud URLs)
    • Test the React Component stories to verify React wrapper functionality
    • Test transcript component with time-synced highlighting
  3. Navigate to "Components/Video Player" section:
    • Test the Web Component stories with different video sources (native video, YouTube, Vimeo, Kaltura)
    • Test the React Component stories to verify React wrapper functionality
    • Verify responsive behavior and controls

Demo Site Testing:

  1. Run the demo site with npm run dev from the root directory
  2. In the chat interface, type the following commands to test each media type:

Audio Testing Commands:

  • Type audio - soundcloud - Tests SoundCloud audio embedding
  • Type audio - mp3 - Tests native mp3 file with transcript functionality

Video Testing Commands:

  • Type video - youtube - Tests YouTube video embedding
  • Type video - vimeo - Tests Vimeo video embedding
  • Type video - kaltura - Tests Kaltura video embedding (may fail due to domain restrictions)

Functional Checklist:

  • audio - soundcloud command loads and plays SoundCloud audio correctly
  • audio - mp3 command loads native mp3 file and displays transcript
  • Transcript highlights sync with audio playback time
  • video - youtube command embeds and plays YouTube video correctly
  • video - vimeo command embeds and plays Vimeo video correctly
  • video - kaltura command attempts to load Kaltura video (expected to fail with domain restriction message)
  • Player controls (play/pause, seek, volume) work as expected for all providers
  • Components are responsive and work at different viewport sizes
  • Accessibility features (keyboard navigation, ARIA labels) function properly
  • Error handling works for invalid URLs or failed loads

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 18, 2026

Deploy Preview for carbon-ai-chat-components ready!

Name Link
🔨 Latest commit 36dea1d
🔍 Latest deploy log https://app.netlify.com/projects/carbon-ai-chat-components/deploys/69c18c0b4d510700093c00af
😎 Deploy Preview https://deploy-preview-1097--carbon-ai-chat-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 18, 2026

Deploy Preview for carbon-ai-chat-demo ready!

Name Link
🔨 Latest commit 36dea1d
🔍 Latest deploy log https://app.netlify.com/projects/carbon-ai-chat-demo/deploys/69c18c0be95b0c00085663fc
😎 Deploy Preview https://deploy-preview-1097--carbon-ai-chat-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 18, 2026

Deploy Preview for ai-chat-components-react ready!

Name Link
🔨 Latest commit 36dea1d
🔍 Latest deploy log https://app.netlify.com/projects/ai-chat-components-react/deploys/69c18c0b2a7e5d00085ab591
😎 Deploy Preview https://deploy-preview-1097--ai-chat-components-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ethanwinters ethanwinters force-pushed the media-player-components branch 2 times, most recently from 1d6c4b4 to 23289c0 Compare March 18, 2026 14:29
@ethanwinters ethanwinters marked this pull request as ready for review March 18, 2026 14:29
@ethanwinters ethanwinters requested a review from a team as a code owner March 18, 2026 14:29
@ethanwinters ethanwinters force-pushed the media-player-components branch from 23289c0 to 36dea1d Compare March 23, 2026 18:52
Copy link
Copy Markdown
Contributor

@davidmenendez davidmenendez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great! just a couple extremely minor things

*/
render() {
const isSoundCloud = this.audioSourceType === AudioSource.SOUNDCLOUD;
const containerClass = `audio-player__container ${isSoundCloud ? "audio-player__container--soundcloud" : ""}`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor, but i think would benefit from classMap

<div class="${containerClass}">
${this.hasError ? this.renderError() : ""}
<div
class="audio-player__provider ${this.hasError
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor, but i think would benefit from classMap

* Internal state: expanded status
*/
@state()
private expanded = false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more often then not i see requests for controlled state functionality from users. so i think we should either offer controlled and uncontrolled or just leave it to be controlled entirely by the user

*/
private renderError() {
return html`
<div class="audio-player__error" role="alert" aria-live="assertive">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor, but i think we should include our class prefix across the classes

const toggleLabel = `${actionLabel} ${displayLabel}`;

return html`
<div class="transcript">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor, but i think we should include our class prefix across the classes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move audio/video response rendering to @carbon/ai-chat-components.

2 participants