Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor Maui Hybrid Android unable to show videos in app data directory-even with custom file provider

$
0
0

I have been using the suggested solution here, to display audio and video stored in the app data directory in a BlazorWebView. The files render correctly on Windows, but on Android they are unable to be found. Is there something I'm missing for Android specifically for this method?

Custom Blazor Webview:

public class MyCustomWebview : BlazorWebView{    public override IFileProvider CreateFileProvider(string contentRootDir)    {        var contentPath = Path.Combine(FileSystem.Current.AppDataDirectory, FolderConstants.ContentFolder);        Directory.CreateDirectory(contentPath);        var lPhysicalFiles = new PhysicalFileProvider(Path.Combine(FileSystem.Current.AppDataDirectory, FolderConstants.ContentFolder));        return new CompositeFileProvider(lPhysicalFiles, base.CreateFileProvider(contentRootDir));    }}

MainPage XAML

<local:MyCustomWebview x:Name="blazorWebView" HostPage="wwwroot/index.html"><BlazorWebView.RootComponents><RootComponent Selector="#app" ComponentType="{x:Type local:Routes}" /></BlazorWebView.RootComponents></local:MyCustomWebview>

I confirmed the file is saved in the App Data Directory, as in:/data/user/0/com.mypackage.whatever/files/Content/VideoContent/MyVideo.mp4And then in my Blazor component it's being rendered as:

<video controls="" style="width:100%;" controlslist="nodownload"><source src="/VideoContent/MyVideo.mp4"><!--!-->                    Your browser does not support the video tag</video>

But, it's giving a 404 error like it can't find the file.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>