Skip to content

Commit

Permalink
Polish README.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanheise committed Nov 13, 2023
1 parent 45e9e71 commit 70eabd6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion just_audio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,17 @@ await playlist.removeAt(3);
// Setting the HTTP user agent
final player = AudioPlayer(
userAgent: 'myradioapp/1.0 (Linux;Android 11) https://myradioapp.com',
useProxyForRequestHeaders: true, // default
);
// Setting request headers
final duration = await player.setUrl('https://foo.com/bar.mp3',
headers: {'header1': 'value1', 'header2': 'value2'});
```

Note: By default, headers are implemented via a local HTTP proxy which on Android, iOS and macOS requires non-HTTPS support to be enabled. See [Platform Specific Configuration](#platform-specific-configuration). To use the platform's native implementation of headers instead of the proxy, pass `useProxyForRequestHeaders: false` into the `AudioPlayer` constructor. On iOS/macOS, this will use the undocumented `AVURLAssetHTTPHeaderFieldsKey` API which may present issues for App Store submission.
Note: By default, headers are implemented via a local HTTP proxy which on Android, iOS and macOS requires non-HTTPS support to be enabled. See [Platform Specific Configuration](#platform-specific-configuration).

Alternatively, settings `useProxyForRequestHeaders: false` will use the platform's native headers implementation without a proxy. Although note that iOS doesn't offer an official native API for setting headers, and so this will use the undocumented `AVURLAssetHTTPHeaderFieldsKey` API (or in the case of the user-agent header on iOS 16 and above, the official `AVURLAssetHTTPUserAgentKey` API).

### Working with caches

Expand Down

0 comments on commit 70eabd6

Please sign in to comment.