Skip to content

Release Aug 27 2025 - Fix for HLS streams#657

Merged
rabilrbl merged 4 commits into
mainfrom
develop
Aug 27, 2025
Merged

Release Aug 27 2025 - Fix for HLS streams#657
rabilrbl merged 4 commits into
mainfrom
develop

Conversation

@rabilrbl

Copy link
Copy Markdown
Collaborator

This pull request introduces several updates across the codebase, focusing on improving HLS playback support by replacing the Shaka Player with Flowplayer in the web player, updating dependency versions, and refining media file matching patterns. The most significant changes are grouped below:

Web Player Migration and UI Updates:

  • Replaced Shaka Player with Flowplayer in player_hls.html, updating the video player initialization, removing Shaka-specific configuration and UI, and adding new external dependencies for Flowplayer and related scripts. The unmute overlay and its styling were also removed.

Media File Matching Improvements:

  • Updated regular expressions in internal/handlers/handlers.go to allow dots in filenames when matching .m3u8, .ts, and .aac files, improving compatibility with a wider range of HLS playlist and segment names. [1] [2]

Dependency and Environment Updates:

  • Upgraded github.com/stretchr/testify from v1.10.0 to v1.11.0 in go.mod for improved testing support.
  • Changed the devcontainer image in .devcontainer/devcontainer.json to use the latest mcr.microsoft.com/devcontainers/go image, removing the explicit version pin.

@rabilrbl rabilrbl merged commit 0aef2b1 into main Aug 27, 2025
15 checks passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 significantly enhances HLS stream playback by migrating the web player from Shaka Player to Flowplayer. It also includes improvements to media file matching for HLS assets and updates to development environment dependencies.

Highlights

  • Web Player Migration: The player_hls.html file has been refactored to replace Shaka Player with Flowplayer, involving changes to player initialization, removal of Shaka-specific UI, and inclusion of new Flowplayer-related CSS and JavaScript assets. The unmute overlay was also removed.
  • Improved HLS File Matching: Regular expressions in internal/handlers/handlers.go were updated to correctly parse HLS playlist and segment filenames containing dots, enhancing compatibility.
  • Dependency Updates: The github.com/stretchr/testify Go module was upgraded to v1.11.0, and the .devcontainer/devcontainer.json configuration was updated to use the latest Go devcontainer image.
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

  1. 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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request successfully migrates the HLS player from Shaka Player to Flowplayer, which simplifies the player implementation. The dependency updates and regex fixes for filenames are also good improvements. I have two main suggestions. First, for the devcontainer, I recommend pinning the base image to a more specific version to ensure a reproducible development environment. Second, in the Go handler, the regular expressions are being compiled on every request, which can be optimized by compiling them once at the package level. This will improve the performance of the playlist rendering.

Comment on lines +304 to 305
pattern := `[a-z0-9=\_\-A-Z\.]*\.m3u8`
re := regexp.MustCompile(pattern)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

regexp.MustCompile is a relatively expensive operation. Since this handler is executed for each request, compiling the same regular expression repeatedly can impact performance.

It's a best practice to compile these regexes once at the package level and reuse the compiled objects. This will significantly improve performance. This comment applies to the other regex compiled on line 326 as well.

Here's how you could refactor it:

// At package level, outside any function
var (
	// Note: the character class has been simplified.
	m3u8FilePattern  = regexp.MustCompile(`[a-zA-Z0-9=._-]*\.m3u8`)
	mediaFilePattern = regexp.MustCompile(`[a-zA-Z0-9=./_-]*\.(m3u8|ts|aac)`)
)

func RenderHandler(c *fiber.Ctx) error {
	// ...
	// baseUrl := []byte(m3u8FilePattern.ReplaceAllString(baseStringUrl, ""))
	// ...
	// re = mediaFilePattern
	// renderResult = re.ReplaceAllFunc(renderResult, replacer)
	// ...
}

"name": "Go",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/go:1-1.25-bullseye",
"image": "mcr.microsoft.com/devcontainers/go",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using a floating tag like latest (which is the default for mcr.microsoft.com/devcontainers/go) can lead to non-reproducible development environments. If a new version of the image is pushed with breaking changes, it could affect all developers. For better reproducibility and stability, it's recommended to pin the image to a specific version or at least a major version tag that aligns with your project's Go version.

Suggested change
"image": "mcr.microsoft.com/devcontainers/go",
"image": "mcr.microsoft.com/devcontainers/go:1-1.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.

1 participant