---
title: Web Notes
description: Learn how to use flutter_soloud on the web
---

## Description

The web platform is now supported, but some testing is welcome.
Please note that filters for single sounds are not supported on the web.

## How to use

To add the plugin to a web app, add the following lines to the `<body>` section of `web/index.html`:
```html
<script src="assets/packages/flutter_soloud/web/libflutter_soloud_plugin.js" defer></script>
<script src="assets/packages/flutter_soloud/web/init_module.dart.js" defer></script>
```

## Build and run

Run the app like any other Flutter web app:

```bash
flutter run -d chrome -t lib/main.dart
```

or, for better performance, with the WasmGC renderer:

```bash
flutter run -d chrome --wasm -t lib/main.dart
```

For release builds, use:

```bash
flutter build web --wasm
```
---

**`loadUrl()`** may produce the following error when the app is run:
>> Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.learningcontainer.com/wp-content/uploads/2020/02/Kalimba.mp3. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.

This is due to the default behavior of HTTP servers which don't allow requests outside their domain. Refer to [this guide](https://enable-cors.org/server.html) to learn how to enable your server to handle this situation.
Instead, if you run the app locally, you could run the app with something like the following command:
```bash
flutter run -d chrome --web-browser-flag '--disable-web-security' -t lib/main.dart --release
```

---

***It is not possible to read a local audio file directly*** on the web. For this reason, `loadMem()` has been added, which requires the `Uint8List` byte buffer of the audio file.
***NOTE***: on the web the `mode` parameter of `loadMem()` is ignored (`LoadMode.disk` is not possible, since browsers cannot read from the local file system). The audio data is instead fed to the engine in chunks, yielding to the event loop between each chunk, so even large files should not freeze the UI.
