-
Notifications
You must be signed in to change notification settings - Fork 108
[MBL-19588][All] Add Studio embed immersive view support #3406
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
base: master
Are you sure you want to change the base?
Conversation
Implements support for Studio embed videos to open in immersive view with "Open in Detail View" buttons. This provides better video viewing experience for Studio content embedded in pages and assignments. Changes: - Detect Studio embed URLs (thumbnail_embed and learn_embed types) - Detect Studio media URLs (media_attachments_iframe) - Transform embed URLs to immersive view format with required parameters - Add "Open in Detail View" buttons below Studio iframes - Route immersive view URLs to InternalWebviewFragment without LTI auth - Extract and pass video titles to immersive view Known limitation: - Buttons inside iframes cannot be intercepted due to WebView cross-origin isolation. Users must use the "Open in Detail View" button below the iframe. - Working with web team on postMessage solution for better UX. Test plan: - Verify Studio embed iframes show "Open in Detail View" button - Verify button navigates to immersive view in InternalWebviewFragment - Verify video title displays correctly in immersive view - Verify standard media uploads continue to work with Expand button 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
📊 Code Coverage Report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Review - Update
I've reviewed the latest changes to this PR. Here's my assessment:
What Changed
This update includes improvements to handle Studio embed URLs in both the RouteMatcher and HtmlContentFormatter:
- RouteMatcher.kt: Added early detection logic for Studio embed immersive view URLs to prevent them from being caught by the generic LTI route matcher
- HtmlContentFormatter.kt:
- Restructured iframe handling logic to check for Studio embeds before generic external tools
- Added new
convertStudioEmbedToImmersiveView()function for URL transformation - Fixed HTML entity escaping in generated buttons (security improvement)
- Added
hasStudioEmbedUrl()helper function
Issues Found
🔴 Must Fix
- Debug logging in production code (RouteMatcher.kt:564-581): Multiple
Logger.e()calls should be removed or changed to debug level - Null-safety concern (RouteMatcher.kt:571): Force-unwrap operator
!!used after insufficient null checks - Missing error handling (HtmlContentFormatter.kt:219): URL decoding operations could fail and should be wrapped in try-catch
🟡 Should Improve
- Performance (RouteMatcher.kt:564-567): Repeated
toString()calls - extract to variable - Code complexity (HtmlContentFormatter.kt:219-276): Complex URL manipulation logic could benefit from simplification and better error handling
❓ Questions
- Test coverage: Are there unit tests for the new
hasStudioEmbedUrl()pattern matching with various encoding scenarios?
Positive Changes
✅ HTML entity escaping fix prevents potential XSS issues
✅ Improved control flow logic prevents routing conflicts
✅ Good separation of concerns between Studio embed types
Please address the must-fix issues before merging.
apps/student/src/main/java/com/instructure/student/router/RouteMatcher.kt
Outdated
Show resolved
Hide resolved
apps/student/src/main/java/com/instructure/student/router/RouteMatcher.kt
Outdated
Show resolved
Hide resolved
apps/student/src/main/java/com/instructure/student/router/RouteMatcher.kt
Show resolved
Hide resolved
libs/pandautils/src/main/java/com/instructure/pandautils/utils/HtmlContentFormatter.kt
Show resolved
Hide resolved
libs/pandautils/src/main/java/com/instructure/pandautils/utils/HtmlContentFormatter.kt
Show resolved
Hide resolved
libs/pandautils/src/main/java/com/instructure/pandautils/utils/HtmlContentFormatter.kt
Show resolved
Hide resolved
libs/pandautils/src/main/java/com/instructure/pandautils/utils/HtmlContentFormatter.kt
Show resolved
Hide resolved
libs/pandautils/src/main/java/com/instructure/pandautils/utils/HtmlContentFormatter.kt
Show resolved
Hide resolved
🧪 Unit Test Results✅ 📱 Parent App
✅ 📱 Student App
✅ 📱 Teacher App
✅ 🌅 Horizon
✅ 📦 Submodules
📊 Summary
Last updated: Fri, 16 Jan 2026 13:34:02 GMT |
Summary
This PR implements support for opening Studio embedded media in immersive view from within content loaded in CanvasWebView. When users encounter Studio LTI embeds in course content (assignments, pages, discussions, etc.), they can now open the media in a full immersive viewing experience.
Changes
Core Implementation
CanvasLTIPostMessageHandler.js: JavaScript file that handles LTI postMessage events in mobile WebViews, supporting both Android and iOS platformsStudioMessageHandlerJavaScript interface to receivefullWindowLaunchmessages from embedded iframesInfrastructure Changes
toBaseUrl()extension forCanvasContext: Generates base URLs for context (e.g.,https://domain.com/courses/123)loadHtml()calls across Student, Teacher, and Parent apps to includebaseUrlparameter, enabling proper URL context for the Studio handlerRouter Updates
Test Fixes
FrontPageViewModelTestin Parent app to accommodate the newbaseUrlparameter and proper mockingTest Plan
Student App
Teacher App
Parent App
All Apps
refs: MBL-19588
affects: Student, Teacher, Parent
release note: Users can now open Studio embedded videos in immersive full-screen view for a better viewing experience
Checklist
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com