Support all video formats inside in-app and inbox players#981
Support all video formats inside in-app and inbox players#981piyush-kukadiya wants to merge 1 commit intotask/release/8.1.0from
Conversation
Replace hardcoded HlsMediaSource.Factory with DefaultMediaSourceFactory in all 4 ExoPlayer/Media3 handle files (inapps + inbox). This enables auto-detection of video format (MP4, HLS, DASH, etc.) from URI, aligning with PIP player behavior. Existing HLS streams continue to work since the HLS module dependencies are still included. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
WalkthroughThe PR refactors ExoPlayer initialization across 4 video handling files by replacing HLS-specific media source construction with a generic Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
clevertap-core/src/main/java/com/clevertap/android/sdk/video/inbox/ExoplayerHandle.kt (1)
52-54: Consider future-proofing VideoLibChecker for format-agnostic video support detection.
VideoLibChecker.ktcurrently requiresHlsMediaSourceclass presence to validate video player availability (lines 45 and 71 for exoplayer and media3 respectively). Since this PR adds multi-format support (DASH, MP4), a future enhancement would be to make the library detection format-agnostic—checking for core ExoPlayer classes rather than HLS-specific ones. This prevents false negatives if HLS module dependencies are eventually removed.Not a concern for this PR, as HLS module dependencies remain included.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@clevertap-core/src/main/java/com/clevertap/android/sdk/video/inbox/ExoplayerHandle.kt` around lines 52 - 54, VideoLibChecker currently detects player availability by checking for HlsMediaSource presence, which can yield false negatives when HLS module is absent; update VideoLibChecker to detect core player classes instead (e.g., com.google.android.exoplayer2.ExoPlayer or androidx.media3.exoplayer.ExoPlayer / androidx.media3.common.Player or DefaultMediaSourceFactory) rather than HlsMediaSource so detection becomes format-agnostic; modify the checks around the current HlsMediaSource lookups (the checks referenced in VideoLibChecker at the locations that now reference HlsMediaSource for ExoPlayer and media3) to attempt Class.forName on these core ExoPlayer/Media3 player or factory classes and fall back appropriately.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@clevertap-core/src/main/java/com/clevertap/android/sdk/video/inbox/ExoplayerHandle.kt`:
- Around line 52-54: VideoLibChecker currently detects player availability by
checking for HlsMediaSource presence, which can yield false negatives when HLS
module is absent; update VideoLibChecker to detect core player classes instead
(e.g., com.google.android.exoplayer2.ExoPlayer or
androidx.media3.exoplayer.ExoPlayer / androidx.media3.common.Player or
DefaultMediaSourceFactory) rather than HlsMediaSource so detection becomes
format-agnostic; modify the checks around the current HlsMediaSource lookups
(the checks referenced in VideoLibChecker at the locations that now reference
HlsMediaSource for ExoPlayer and media3) to attempt Class.forName on these core
ExoPlayer/Media3 player or factory classes and fall back appropriately.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 23f274d7-312c-4068-8d9d-9a87239385cb
📒 Files selected for processing (4)
clevertap-core/src/main/java/com/clevertap/android/sdk/video/inapps/ExoplayerHandle.ktclevertap-core/src/main/java/com/clevertap/android/sdk/video/inapps/Media3Handle.ktclevertap-core/src/main/java/com/clevertap/android/sdk/video/inbox/ExoplayerHandle.ktclevertap-core/src/main/java/com/clevertap/android/sdk/video/inbox/Media3Handle.kt
Replace hardcoded HlsMediaSource.Factory with DefaultMediaSourceFactory in all 4 ExoPlayer/Media3 handle files (inapps + inbox). This enables auto-detection of video format (MP4, HLS, DASH, etc.) from URI, aligning with PIP player behavior. Existing HLS streams continue to work since the HLS module dependencies are still included.
Summary by CodeRabbit