Skip to content

Revert "dd: disable audio (revert this when infra ready) (#615)" #645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025

Conversation

mjh1
Copy link
Contributor

@mjh1 mjh1 commented May 20, 2025

User description

This reverts commit e3f2eb6.


PR Type

Enhancement


Description

  • Uncomment toggleAudio call for automatic audio enable

  • Remove explicit silentAudioTrack and audio disable props

  • Add audio enable/disable button to broadcast controls


Changes walkthrough 📝

Relevant files
Enhancement
broadcast.tsx
Enable audio toggling and UI control                                         

apps/app/components/playground/broadcast.tsx

  • Uncommented setTimeout call toggling audio state
  • Removed silentAudioTrack={false} and audio={false} props
  • Added Broadcast.AudioEnabledTrigger control button
  • +12/-4   

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • Copy link

    vercel bot commented May 20, 2025

    The latest updates on your projects. Learn more about Vercel for Git ↗︎

    Name Status Preview Comments Updated (UTC)
    pipelines-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 20, 2025 8:02am

    Copy link

    github-actions bot commented May 20, 2025

    PR Reviewer Guide 🔍

    (Review updated until commit fc98fed)

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Timeout Cleanup

    The setTimeout call in the effect is not cleared on dependencies change or unmount, which may cause unexpected toggles or memory leaks.

    setTimeout(() => {
      if (state.audio && state.__controlsFunctions?.toggleAudio) {
        state.__controlsFunctions.toggleAudio();
      }
    }, 1000);
    
    Boolean Prop Clarity

    Using the shorthand silentAudioTrack prop (without explicit assignment) may lead to ambiguity. Consider using silentAudioTrack={true} for clarity and ensure the audio prop behavior aligns.

    silentAudioTrack
    
    Accessibility

    The new audio toggle button lacks accessible labels or ARIA attributes, which may hinder screen reader support.

    <Broadcast.AudioEnabledTrigger className="w-6 h-6 hover:scale-110 transition flex-shrink-0">
      <Broadcast.AudioEnabledIndicator asChild matcher={false}>
        <DisableAudioIcon className="w-full h-full text-white/50" />
      </Broadcast.AudioEnabledIndicator>
      <Broadcast.AudioEnabledIndicator asChild matcher={true}>
        <EnableAudioIcon className="w-full h-full text-white/50" />
      </Broadcast.AudioEnabledIndicator>
    </Broadcast.AudioEnabledTrigger>
    

    Copy link

    github-actions bot commented May 20, 2025

    PR Code Suggestions ✨

    Latest suggestions up to fc98fed
    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Clear timeout on unmount

    Store the timeout ID and clear it in the effect’s cleanup to avoid toggling audio
    after unmount or when dependencies change.

    apps/app/components/playground/broadcast.tsx [65-69]

    -setTimeout(() => {
    +const timeoutId = setTimeout(() => {
       if (state.audio && state.__controlsFunctions?.toggleAudio) {
         state.__controlsFunctions.toggleAudio();
       }
     }, 1000);
    +return () => clearTimeout(timeoutId);
    Suggestion importance[1-10]: 8

    __

    Why: Adding a cleanup with clearTimeout(timeoutId) prevents toggleAudio from firing after unmount or deps change, improving component stability.

    Medium
    General
    Add accessible button label

    Add an accessible label to the audio toggle trigger for better screen reader
    support.

    apps/app/components/playground/broadcast.tsx [291]

    -<Broadcast.AudioEnabledTrigger className="w-6 h-6 hover:scale-110 transition flex-shrink-0">
    +<Broadcast.AudioEnabledTrigger
    +  className="w-6 h-6 hover:scale-110 transition flex-shrink-0"
    +  aria-label="Toggle audio"
    +>
    Suggestion importance[1-10]: 5

    __

    Why: Including an aria-label on <Broadcast.AudioEnabledTrigger> enhances accessibility by providing screen readers with clear context.

    Low
    Explicitly enable audio

    Explicitly set the audio prop to true to ensure audio is enabled, as omitting the
    prop may rely on its default value and cause confusion.

    apps/app/components/playground/broadcast.tsx [139]

     silentAudioTrack
    +audio={true}
    Suggestion importance[1-10]: 4

    __

    Why: Adding audio={true} clarifies intent but is likely redundant if the default is already enabled, making this a low-impact style change.

    Low

    Previous suggestions

    Suggestions up to commit fc98fed
    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Clear timeout on unmount

    Store the timeout ID and clear it in a cleanup callback so the toggle won't fire
    after the component unmounts or dependencies change. This prevents potential memory
    leaks and unwanted toggles. Wrap the logic in a ref or local variable and return a
    cleanup function from the effect.

    apps/app/components/playground/broadcast.tsx [65-69]

    -setTimeout(() => {
    +const audioToggleTimer = setTimeout(() => {
       if (state.audio && state.__controlsFunctions?.toggleAudio) {
         state.__controlsFunctions.toggleAudio();
       }
     }, 1000);
    +return () => clearTimeout(audioToggleTimer);
    Suggestion importance[1-10]: 8

    __

    Why: Clearing the setTimeout in a cleanup prevents memory leaks and unwanted toggles after unmount, improving component reliability.

    Medium
    Explicitly enable audio

    Make the audio configuration explicit to avoid unintended silent tracks or stale
    defaults. For example, set audio={true} to enable audio and silentAudioTrack={false}
    to ensure the track isn't muted by default.

    apps/app/components/playground/broadcast.tsx [139]

    -silentAudioTrack
    +silentAudioTrack={false}
    +audio={true}
    Suggestion importance[1-10]: 7

    __

    Why: Restoring silentAudioTrack={false} and adding audio={true} fixes unintended muting from the new shorthand prop, ensuring audio streams correctly.

    Medium
    General
    Add aria-label for accessibility

    Add an accessible label or title to the audio trigger so screen readers can convey
    its purpose. This improves usability for assistive technologies. Use aria-label or
    title with a clear description.

    apps/app/components/playground/broadcast.tsx [291]

    -<Broadcast.AudioEnabledTrigger className="w-6 h-6 hover:scale-110 transition flex-shrink-0">
    +<Broadcast.AudioEnabledTrigger
    +  aria-label="Toggle audio"
    +  className="w-6 h-6 hover:scale-110 transition flex-shrink-0"
    +>
    Suggestion importance[1-10]: 5

    __

    Why: Adding an aria-label makes the audio toggle button usable by screen readers, improving accessibility with minimal code change.

    Low

    @junhyoung-ryu junhyoung-ryu marked this pull request as ready for review May 21, 2025 02:48
    @junhyoung-ryu junhyoung-ryu merged commit f316235 into main May 21, 2025
    7 checks passed
    @junhyoung-ryu junhyoung-ryu deleted the mh/audio branch May 21, 2025 02:48
    Copy link

    Persistent review updated to latest commit fc98fed

    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