Skip to content

Conversation

@rajkumargaramie
Copy link
Contributor

@rajkumargaramie rajkumargaramie commented Jan 30, 2026

image

@cloudflare-workers-and-pages
Copy link

Deploying ui with  Cloudflare Pages  Cloudflare Pages

Latest commit: f8537d6
Status: ✅  Deploy successful!
Preview URL: https://ab6d0640.ui-6d0.pages.dev
Branch Preview URL: https://new-variant-audioplayer.ui-6d0.pages.dev

View logs

@rajkumargaramie rajkumargaramie removed the request for review from wreiske January 30, 2026 02:38
@wreiske
Copy link
Member

wreiske commented Feb 6, 2026

@rajkumargaramie looks like there are some conflicts here. Can you fix them?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new full visual variant to the AudioPlayer component, combining a WaveSurfer waveform with a scrub-able progress bar, and exposes waveform-related exports for external use.

Changes:

  • Added full variant styling and behavior to AudioPlayer (WaveSurfer + progress bar).
  • Refactored Waveform into a forwardRef component with an exported imperative WaveformHandle (for syncing seeks).
  • Updated Storybook to include the full variant stories and variant selector option.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/components/AudioPlayer/index.ts Re-exports Waveform and WaveformHandle from AudioPlayer.
src/components/AudioPlayer/AudioPlayer.tsx Implements full variant and adds imperative waveform seeking support via ref.
src/components/AudioPlayer/AudioPlayer.stories.tsx Adds Storybook coverage and controls for the new full variant.
Comments suppressed due to low confidence (1)

src/components/AudioPlayer/AudioPlayer.tsx:803

  • onReady={handleWaveformReady} currently calls setState('idle') unconditionally. If the user clicks Play before WaveSurfer finishes loading, the state can flip to playing and then be reset back to idle on ready, cancelling the play request and desyncing the play button from actual playback. Consider tracking waveform readiness/loading and only transitioning to idle from loading, or preserving the prior state (e.g., keep playing if the user already requested playback) and use updateState so onStateChange stays consistent.
      <Waveform
        ref={waveformRef}
        src={src}
        isPlaying={isPlaying}
        playbackRate={playbackRate}
        onReady={handleWaveformReady}
        onTimeUpdate={handleWaveformTimeUpdate}
        onFinish={handleWaveformFinish}
        onSeek={handleWaveformSeek}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 369 to 380
wavesurferRef.current.on('seeking', () => {
onTimeUpdate(wavesurferRef.current.getCurrentTime());
const time = wavesurferRef.current.getCurrentTime();
onTimeUpdate(time);
onSeek(time);
});

wavesurferRef.current.on('interaction', () => {
onSeek(wavesurferRef.current.getCurrentTime());
// Handle seek events (fired after seeking is complete)
wavesurferRef.current.on('seek', () => {
const time = wavesurferRef.current.getCurrentTime();
onTimeUpdate(time);
onSeek(time);
});
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

WaveSurfer event handlers call both onTimeUpdate and onSeek for both seeking and seek events. This can invoke onTimeUpdate/onSeek multiple times per user action (and continuously while scrubbing), which is redundant and can cause avoidable re-renders/work for consumers. Consider firing onTimeUpdate only from audioprocess/seeking, and onSeek only once when the seek is finalized (pick a single event), or add de-duping so one interaction doesn't emit duplicate updates.

Copilot uses AI. Check for mistakes.
Comment on lines 302 to 307
onReady,
onTimeUpdate,
onFinish,
onSeek,
waveColor,
progressColor,
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

The Waveform prop destructuring indentation appears broken (e.g., onReady, onTimeUpdate, etc. are misaligned). This makes the component harder to read and likely indicates the file wasn't run through the formatter after the refactor. Re-run Prettier/formatting to normalize indentation.

Suggested change
onReady,
onTimeUpdate,
onFinish,
onSeek,
waveColor,
progressColor,
onReady,
onTimeUpdate,
onFinish,
onSeek,
waveColor,
progressColor,

Copilot uses AI. Check for mistakes.
@rajkumargaramie
Copy link
Contributor Author

I am working on using Waveform variant with cursor instead of this full variant. So this PR is differed for now.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants