Open ryanheise opened 3 years ago
Hey @ryanheise
I would like to be able to set Request Headers for .mp3
files for Web.
Right now it throws 403 error
and did not add any headers.
pubspec.yaml
sigv4:
git:
url: https://github.com/bartuszak/sigv4.git
ref: null-safety
just_audio: ^0.7.3
Flutter team added possibility to attach request headers with Video Player
(maybe it can help) https://github.com/flutter/plugins/pull/3671
Regarding video_player, I don't think it has headers for web yet, so I think it's more or less caught up to just_audio which already has headers for all platform "except" for web.
For web, I'm waiting for a way to write a custom service worker and link it into Flutter's build process.
@ryanheise
Yes, it is. There is a working example with video_player
and signed headers
https://github.com/balvinderz/video_player_web_hls/pull/10/commits/761bbd3f36805cee0cb7bfa9956d00bb9b22dd31
It's just a POC and still need improvements, but it works https://github.com/balvinderz/video_player_web_hls/issues/8
Feel free to check out provided links for details.
HLS with Secured Headers
for audio is one of core requirements that I have to implement.
I can use video_player
to handle it but I feel like it's totally not what is should look like.
Can you please give me any advice what should I do? Thanks in advance.
@ryanheise any update on that one?
Is there any way to add request headers to a source with HTTPS request on WEB?
eg.:
_playlist = ConcatenatingAudioSource(
children: widget.audiobook.content
.map(
(content) => AudioSource.uri(
Uri.parse(widget.audiobook.url + content.file),
headers: _s3Repository.generateSignedHeaders(
widget.audiobook.url + content.file),
tag: AudioMetadata(
title: content.title, artwork: widget.audiobook.cover)),
)
.toList());
@kamilsztandur
I'm sorry I have been a bit busy on other issues, and so this hasn't been the highest priority.
However, I'm happy to accept pull requests or also discussions suggesting how to go about implementing this.
Your linked example seems interesting, but to help things along, can you summarise the key points its approach and what needs to be done to copy that approach? For example, does it use something else instead of service workers?
Is your feature request related to a problem? Please describe.
Some audio sources require request headers (e.g. to authenticate) but these are not currently supported for web.
Describe the solution you'd like
This could in theory be supported using service workers, although Flutter's support for service workers isn't there yet.
Describe alternatives you've considered
Additional context
There is a service_worker package but it is not integrated with Flutter's build process.