feat: Force DRM component only for neccessary channels and remove old flowplayer for HLS - #630
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @rabilrbl, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request refactors the application's video streaming logic to better differentiate between DRM-protected and non-DRM live streams. It updates the backend API to explicitly indicate DRM status and replaces the legacy Flowplayer with Shaka Player for non-DRM HLS streams on the frontend, enhancing compatibility and user experience.
Highlights
- DRM Handling Refinement: The backend now includes an "IsDRM" boolean field in the "DrmMpdOutput" struct and adjusts API responses to clearly distinguish between DRM and non-DRM channels.
- Default DRM Enablement: The "EnableDRM" configuration is now set to "true" by default, ensuring DRM support is always available for channels that require it.
- Frontend Player Migration: Flowplayer and its associated dependencies have been removed and replaced with Shaka Player for handling non-DRM HLS streams, improving playback capabilities and error handling.
- Enhanced Debugging: A new log statement has been added to output the full API response string in the "Television" struct's "Live" method, aiding in debugging and traceability.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Pull Request Overview
This pull request enhances the video streaming experience by distinguishing between DRM and non-DRM channels and replacing Flowplayer with Shaka Player for non-DRM content. The changes improve compatibility and ensure DRM functionality is only applied where necessary.
Key changes:
- Added DRM detection logic to return appropriate responses based on channel capabilities
- Replaced Flowplayer with Shaka Player for non-DRM streams in the frontend
- Set DRM support to be enabled by default but only used for channels that require it
Reviewed Changes
Copilot reviewed 6 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| web/views/flow_player.html | Complete replacement of Flowplayer implementation with Shaka Player for non-DRM streams |
| web/static/external/flowplayer.css | Removal of entire Flowplayer CSS file (2089 lines deleted) |
| pkg/television/television.go | Minor formatting change removing empty line |
| internal/handlers/types.go | Added IsDRM boolean field to DrmMpdOutput struct |
| internal/handlers/handlers.go | Changed EnableDRM default to always true with explanatory comment |
| internal/handlers/drm.go | Added logic to handle non-DRM channels and return appropriate responses |
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
There was a problem hiding this comment.
Code Review
This pull request successfully replaces Flowplayer with Shaka Player for HLS streams and refactors the backend to distinguish between DRM and non-DRM channels. This is a great improvement for compatibility and user experience. The changes are well-structured. My feedback includes a small refactoring suggestion in the Go backend for code clarity and a few suggestions for the new Shaka Player implementation in flow_player.html to improve user experience and code hygiene, particularly around autoplay behavior and error handling. These suggestions would likely also apply to flow_player_drm.html.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request effectively refactors the application to handle both DRM and non-DRM streams by introducing a backend flag and switching to Shaka Player for HLS playback. The removal of Flowplayer and its dependencies cleans up the frontend assets.
My review focuses on improving maintainability and user experience. I've identified some code duplication in the Go handlers that could be refactored into a helper function. Additionally, the error handling in the new Shaka Player implementation could be enhanced by replacing alert() calls with a more integrated UI-based error display.
This pull request introduces significant improvements to how DRM and non-DRM live streams are handled and presented in the application. The main changes include distinguishing between DRM and non-DRM channels in the backend, updating the API responses, and switching the frontend video player for non-DRM streams from Flowplayer to Shaka Player. These updates improve compatibility and user experience for non-DRM channels while ensuring that DRM logic is more robust and explicit.
Backend: DRM/Non-DRM Handling
IsDRMboolean field to theDrmMpdOutputstruct and updated the backend logic to return different responses depending on whether a channel uses DRM. This ensures that the frontend can correctly distinguish between DRM and non-DRM streams and render the appropriate player. [1] [2] [3] [4] [5]EnableDRMto always betrue, so DRM support is enabled by default and only used for channels that require it.Frontend: Video Player Update for Non-DRM Streams
flow_player.html. The new implementation uses Shaka Player's UI and configuration for improved playback and error handling, and includes logic for screen orientation changes on fullscreen.Logging and Debugging
Livemethod of theTelevisionstruct for better debugging and traceability.