Skip to content

Fix mini player visibility#213

Open
yonaries wants to merge 5 commits intomainfrom
tembo/fix-mini-player-trigger-no-media
Open

Fix mini player visibility#213
yonaries wants to merge 5 commits intomainfrom
tembo/fix-mini-player-trigger-no-media

Conversation

@yonaries
Copy link
Copy Markdown
Contributor

@yonaries yonaries commented Mar 2, 2026

Summary

Fixed mini media player being incorrectly triggered on pages without audible media playing (issue #187).

Key changes:

  • Updated MediaController.swift to check visibleSessions.isEmpty instead of sessions.isEmpty for player visibility
  • Added isAudible() helper function in WebViewNavigationDelegate.swift to check if media element is unmuted and has volume > 0
  • Modified media event listeners to only mark media as played (__oraWasPlayed) when it's audible:
    • play event now checks if media is audible before marking as played
    • volumechange event marks media as played when becoming audible while playing
    • Initial state check only marks as played if media is audible

This ensures the mini player only appears for media that is actually producing sound.


Want tembo to make any changes? Add a review or comment with @tembo and i'll get back to work!

View on Tembo View Agent Settings

Co-authored-by: Yonathan <yonathandejenee@gmail.com>
Copilot AI review requested due to automatic review settings March 2, 2026 08:35
@yonaries yonaries requested a review from kenenisa as a code owner March 2, 2026 08:35
@tembo tembo bot added the tembo Pull request created by Tembo label Mar 2, 2026

This comment was marked as outdated.

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 2, 2026

Greptile Summary

This PR correctly fixes the mini player visibility issue by ensuring only audible media triggers the player. The implementation uses a wasPlayed flag that's only set when media is unmuted with volume > 0, and filters visible sessions accordingly.

Key implementation details:

  • Added isAudible() helper checking !muted && volume > 0
  • Modified play, volumechange, and initial state checks to conditionally set __oraWasPlayed flag
  • Changed MediaController to filter sessions by wasPlayed status
  • Once media becomes audible, it remains in the mini player even if later muted (indicating user engagement)

The logic correctly handles edge cases including muted autoplay videos, volume changes, and media that becomes audible while playing.

Confidence Score: 5/5

  • This PR is safe to merge with no identified issues
  • The changes are well-targeted, solving the specific issue without introducing side effects. The implementation correctly handles multiple edge cases (muted media, volume=0, unmuting while playing) and maintains backward compatibility with the existing volume update mechanism.
  • No files require special attention

Important Files Changed

Filename Overview
ora/Services/MediaController.swift Changed mini player visibility to check visibleSessions.isEmpty instead of sessions.isEmpty, filtering for sessions with audible media
ora/Services/WebViewNavigationDelegate.swift Added isAudible() helper and updated event listeners to only mark media as played when unmuted with volume > 0

Sequence Diagram

sequenceDiagram
    participant Media as Media Element
    participant JS as JavaScript Bridge
    participant Swift as MediaController
    participant UI as Mini Player

    Note over Media,UI: Scenario: Muted media becomes audible

    Media->>JS: play event (muted)
    JS->>JS: isAudible() = false
    Note over JS: __oraWasPlayed NOT set
    JS->>Swift: state message (wasPlayed: undefined)
    Swift->>Swift: Create session (wasPlayed: false)
    Note over UI: Mini player NOT visible

    Media->>JS: volumechange event (unmuted)
    JS->>JS: isAudible() = true
    JS->>JS: Set __oraWasPlayed = true
    JS->>Swift: state message (wasPlayed: true)
    JS->>Swift: volume message
    Swift->>Swift: Update session (wasPlayed: true)
    Swift->>Swift: isVisible = !visibleSessions.isEmpty
    Swift->>UI: Show mini player
Loading

Last reviewed commit: 6acf169

@tembo tembo bot added the bug Something isn't working label Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working tembo Pull request created by Tembo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants