Skip to content

feat: Enable CI/CD-Ready Configuration of OPUS/OGG Support for Web Projects #355

Description

@DarthRainbows

feat: Enable Build-Time Configuration of OPUS/OGG Support for Web Projects

Description

This feature request addresses the critical limitation for developers and CI/CD pipelines where it is currently impossible to disable OPUS/OGG support for the web platform without modifying the internal source files of the flutter_soloud package.

The current official documentation suggests editing the package's internal web/compile_wasm.sh script, which is ineffective because the WASM binaries are not compiled at application build time (flutter build web). It prevents disabling OPUS/OGG support in web apps built in CI/CD environments. Furthermore, this violates package immutability and dependency integrity; requiring users to modify the code base of a dependency package is an anti-pattern.

Requirements

The solution must use only tools available to the base Flutter SDK and not require custom third-party tooling outside of pubspec.yaml declarations or standard build arguments.

I propose two distinct, Flutter SDK compliant mechanisms for application developers to configure OPUS/OGG support.

  1. Configuration via package dependency
    • Mechanism: Refactor the package structure into three distinct packages to allow for declarative inclusion/exclusion of the OPUS/OGG binaries via pubspec.yaml:
      • flutter_soloud_core: Contains all core SoLoud logic without OPUS/OGG support. This is the minimum required package.
      • flutter_soloud_opus_ogg: A dedicated plugin package containing the OPUS/OGG code.
      • flutter_soloud: This package should remain for backwards-compatibility with the existing user base. It should simply re-export flutter_soloud_core and flutter_soloud_opus_ogg to provide the current default behavior (OPUS/OGG enabled, use configuration to disable).
    • Example Usage (Disable OGG/OPUS): Only depend on flutter_soloud_core in pubspec.yaml.
  2. Configuration via a build-time variable
    • Mechanism: The flutter_soloud package should compile and ship two distinct WASM binary sets (e.g., soloud.wasm and soloud_opus_ogg.wasm).
    • The package's initialization logic must read a build-time variable, either from environment variables or passed via a --dart-define flag.
    • Based on this flag, the Dart code loads the corresponding WASM asset.
    • Example Usage: flutter build web --dart-define=NO_OPUS_OGG_LIBS="1"

Additional Context

Both proposed solutions offer significant advantages over the current situation:

  • Option 1 offers a simplified solution for developers to disable OPUS/OGG support without needing to muddle through all of the configuration requirements, while maintaining backwards compatibility with existing applications
  • Option 2 is potentially simpler for the SoLoud team to implement and maintain

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions