Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How would I stream images in the MAUI App? #33

Open
maptz opened this issue Nov 16, 2021 · 3 comments
Open

How would I stream images in the MAUI App? #33

maptz opened this issue Nov 16, 2021 · 3 comments

Comments

@maptz
Copy link

maptz commented Nov 16, 2021

Hi @danroth27 ,

I was fiddling with this sample as my first experience of Blazor-Maui. This is looking super-cool!

I wanted to amend the app to serve images that are generated dynamically within the app (ie not by an external web-service) based on some weather-criteria. How would I go about doing this?

For e.g. imagine a weather image based on some data:

<img src="/img-generator-service?data=576587" />

How would I instantiate a service in the MAUI app that would mimic a webserver serving bytes to localhost?

e.g. to host something like:

public async Task<byte[]> ImgGeneratorService(string data);
//Or in the asp.net core pattern:
[HttpGet("img-generator-service")
public async Task<IActionResult> Get(string data);
@nvmkpk
Copy link

nvmkpk commented Dec 14, 2021

Content in blazor desktop and MAUI are served via IFileProvider. You would need to implement this interface to serve your generated content. However, with current release, you will not be able to plug in your implementation. This appears to be fixed but not released yet.

@maptz
Copy link
Author

maptz commented Dec 14, 2021

Ok. Makes sense. When you say "will not be able to plug in your implementation", you mean I can't register the IFileProvider service yet?

@nvmkpk
Copy link

nvmkpk commented Dec 15, 2021

BlazorWebView does not obtain IFileProvider from DI. It instantiates PhysicalFileProvider in a private method. The change that I see now is that they added a virtual method that we can override and return our own implementation to augment the current PhysicalFileProvider. You can see more details here: dotnet/maui@55175b8#diff-0c065d47653e514388503b6e1cb075c67ce6fef6f6f955c9cdc78d51a47e5ecf

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

No branches or pull requests

2 participants