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.