Skip to content

Conversation

@tamaskozmer
Copy link
Contributor

No description provided.

tamaskozmer and others added 2 commits December 9, 2025 15:18
refs: MBL-19580
affects: Student, Teacher
release note: none

* Fixed asyncTaskLoader

* ExoPlayer fixes

* Removed unused stuff.

* Changed pr-pipeline

* fixed local videos

---------

Co-authored-by: kristof.nemere <[email protected]>
Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Review Summary

This PR removes the RouteUtils.getMediaUri() async redirect-following logic and simplifies media URL handling across the codebase. The change reduces complexity by eliminating network calls for URL resolution, but there are some concerns about potential behavioral changes.

Issues Found

  • Critical: Loss of redirect handling - The original code followed HTTP redirects to resolve final media URLs. The new code uses URLs directly, which may break media playback if Canvas uses redirects to CDNs or signed URLs (libs/pandautils/src/main/java/com/instructure/pandautils/loaders/OpenMediaAsyncTaskLoader.kt)
  • Null safety issue - Missing null check for response body could cause NPE (libs/pandautils/src/main/java/com/instructure/pandautils/loaders/OpenMediaAsyncTaskLoader.kt:342)
  • Error handling gaps - downloadWithHeaders() throws IOException but callers may not handle it properly (libs/pandautils/src/main/java/com/instructure/pandautils/loaders/OpenMediaAsyncTaskLoader.kt:285)
  • State management issue - triedMpdRetry flag in ExoPlayerHelper is never reset, could cause issues if agent is reused (libs/pandautils/src/main/java/com/instructure/pandautils/utils/ExoPlayerHelper.kt:174)
  • Simplified URL detection - BaseRouterActivity now checks URL extensions directly instead of following redirects, may miss media files with redirect URLs (apps/student/src/main/java/com/instructure/student/activity/BaseRouterActivity.kt:319)

Positive Changes

  • Improved performance: Eliminates unnecessary HEAD requests for media URLs, reducing latency and network usage
  • Code simplification: Removes async complexity from media URI resolution, making the code easier to maintain
  • Better caching logic: The refactored downloadWithHeaders() method consolidates header parsing and file download into a single request
  • Smart retry logic: ExoPlayerHelper adds automatic .mpd extension retry for DASH videos, which is a nice improvement

Testing Recommendations

  1. Redirect scenarios: Test with Canvas media URLs that redirect to CDN endpoints
  2. DASH videos: Verify the .mpd retry logic works correctly in ExoPlayerHelper
  3. Error cases: Test network failures, malformed URLs, and missing Content-Type headers
  4. File format detection: Verify media playback works for URLs without file extensions
  5. Agent reuse: Test that ExoPlayerHelper works correctly when reused for multiple videos

Security Considerations

No significant security issues identified. The code properly uses authentication headers and follows secure practices for file handling.

Performance

Overall positive performance impact due to elimination of the HEAD request in RouteUtils.getMediaUri(). However, ensure this doesn't cause issues with media that requires redirect resolution.

Copy link
Contributor

@adamNagy56 adamNagy56 left a comment

Choose a reason for hiding this comment

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

QA +1

Copy link
Contributor

@kdeakinstructure kdeakinstructure left a comment

Choose a reason for hiding this comment

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

QA 👍

@tamaskozmer tamaskozmer merged commit 1d8078e into release/student Dec 11, 2025
12 checks passed
@tamaskozmer tamaskozmer deleted the release/student-8.4.1-284 branch December 11, 2025 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants