Skip to content

Conversation

@adalpari
Copy link
Contributor

@adalpari adalpari commented Nov 5, 2025

Description

This PR is improving the UX when browsing a video attachment in a support ticket.
The user can now see a video-thumbnail and preview it inside the app.

I noticed we are not using the more modern ExoPlayer library (it's not a version problem, but a library one), so I had to add an OkHttp workaround to fix the limitations the current library has with authentication redirections.

Aspect ExoPlayerVideoApp (Working) WordPress-Android (Not Working)
Library androidx.media3:media3-exoplayer:1.2.0 com.google.android.exoplayer:exoplayer:2.13.3
Version Media3 1.2.0 (2023) ExoPlayer2 2.13.3 (2020)
Redirect Handling Built-in redirect support Requires manual configuration
Screenshot 2025-11-05 at 17 09 11

So, if we see problems playing the videos I would suggest to skip full-screen videos until we migrate to the new library.

Testing instructions

  1. Log in with a WP.COM account and enable MODERN_SUPPORT FF
  2. Create a support ticket with images and videos
  • Browse images and videos and verify that thumbnails and full-screen works
Screen_recording_20251105_170325.mp4

@dangermattic
Copy link
Collaborator

dangermattic commented Nov 5, 2025

4 Warnings
⚠️ strings.xml files should only be updated on release branches, when the translations are downloaded by our automation.
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
⚠️ Class VideoUrlResolver is missing tests, but unit-tests-exemption label was set to ignore this.
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Nov 5, 2025

App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
FlavorJalapeno
Build TypeDebug
Versionpr22340-ddce77e
Commitddce77e
Direct Downloadwordpress-prototype-build-pr22340-ddce77e.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Nov 5, 2025

App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
FlavorJalapeno
Build TypeDebug
Versionpr22340-ddce77e
Commitddce77e
Direct Downloadjetpack-prototype-build-pr22340-ddce77e.apk
Note: Google Login is not supported on these builds.

@adalpari
Copy link
Contributor Author

adalpari commented Nov 5, 2025

@claude

@wordpress-mobile wordpress-mobile deleted a comment from claude bot Nov 5, 2025
…nversations' of https://github.com/wordpress-mobile/WordPress-Android into feat/CMM-930-support-Improve-the-video-thumbnails-in-conversations
@claude
Copy link

claude bot commented Nov 5, 2025

Claude finished @adalpari's task —— View job


PR Review Summary

Todo List:

  • Read the changed files to understand current implementation
  • Determine what assistance is needed
  • Provide appropriate response

Great work addressing the previous review comments! I can see you've made excellent improvements in commit 2be2aa7. Here's a summary of what was addressed:

✅ Issues Resolved

  1. Fixed typo: SUCESSFULLY_RESOLVED_CODESUCCESSFULLY_RESOLVED_CODE (VideoUrlResolver.kt:12)
  2. Localized strings: Moved hardcoded strings to strings.xml for proper internationalization (AttachmentFullscreenVideoPlayer.kt:137, 142, 154)
  3. Performance improvement: Made OkHttpClient a lazy class-level property instead of creating a new instance for every URL resolution (VideoUrlResolver.kt:23-31)
  4. Added timeouts: Configured connect, read, and write timeouts (30 seconds) to prevent ANR on slow/unresponsive servers (VideoUrlResolver.kt:27-29)
  5. Removed no-op interceptor: Eliminated the unnecessary network interceptor that was adding overhead without providing value
  6. Improved null safety: Replaced !! operator with safe call pattern using early return (AttachmentFullscreenVideoPlayer.kt:71)
  7. Accessibility improvement: Added contentDescription for the play icon overlay (HEConversationDetailScreen.kt:467)

⚠️ Remaining Issue

Deprecated API Usage (Acknowledged by author)

The use of SimpleExoPlayer (AttachmentFullscreenVideoPlayer.kt:42, 73) is deprecated. As noted in the PR description, the app is using the older ExoPlayer2 library (v2.13.3 from 2020) instead of the modern Media3 library (v1.2.0+).

Current workaround: The VideoUrlResolver with OkHttpClient handles redirect chains that the older ExoPlayer2 can't handle natively.

Future recommendation: When the app migrates to androidx.media3:media3-exoplayer, you'll be able to:

  • Use the modern ExoPlayer interface instead of SimpleExoPlayer
  • Potentially remove the VideoUrlResolver workaround as Media3 handles redirects natively
  • Simplify the video playback implementation

Code Quality Assessment

The implementation is now solid and production-ready:

  • ✅ Proper error handling with user-friendly error states
  • ✅ Good UX with loading indicators during URL resolution
  • ✅ Resource management (proper ExoPlayer disposal in DisposableEffect)
  • ✅ Internationalization support
  • ✅ Accessibility considerations
  • ✅ Performance optimizations (lazy client initialization, timeouts)

The code follows Android best practices and handles edge cases well. The deprecated API usage is a known limitation of the current ExoPlayer version and is appropriately documented.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 5, 2025

@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

❌ Patch coverage is 0% with 187 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.15%. Comparing base (80ea280) to head (ddce77e).

Files with missing lines Patch % Lines
...d/support/he/ui/AttachmentFullscreenVideoPlayer.kt 0.00% 118 Missing ⚠️
...ndroid/support/he/ui/HEConversationDetailScreen.kt 0.00% 42 Missing ⚠️
...dpress/android/support/he/util/VideoUrlResolver.kt 0.00% 27 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #22340      +/-   ##
==========================================
- Coverage   39.21%   39.15%   -0.07%     
==========================================
  Files        2201     2203       +2     
  Lines      105788   105955     +167     
  Branches    15009    15024      +15     
==========================================
  Hits        41485    41485              
- Misses      60811    60978     +167     
  Partials     3492     3492              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@jkmassel jkmassel left a comment

Choose a reason for hiding this comment

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

Worked as described on-device.

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.

5 participants