fix(web): 恢复视频继续播放和进度保存
- 将播放器收敛为单个共享实例,避免列表/网格内多个 video ref 导致进度保存失效 - 恢复视频播放器上方的继续播放提示 - 在播放、暂停、拖动、结束、切换页面和离开页面时保存播放位置 - 保留文件浏览分页和排序参数的前端调用
This commit is contained in:
@@ -2,6 +2,7 @@ using FileShare_Common.Core;
|
||||
using FileShare_Services.Core;
|
||||
using FileShare_Services.Services.FileLibrary;
|
||||
using FileShare_Services.Services.QrCode;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace FileShare_Services.Endpoints
|
||||
{
|
||||
@@ -119,12 +120,15 @@ namespace FileShare_Services.Endpoints
|
||||
private static async Task<object?> GetFileStreamAsync(ServiceEndpointContext ctx)
|
||||
{
|
||||
var sp = ctx.Items["ServiceProvider"] as IServiceProvider;
|
||||
var service = sp?.GetService(typeof(IFileStreamService)) as IFileStreamService;
|
||||
if (service is null) return null;
|
||||
if (sp is null) return null;
|
||||
|
||||
if (!int.TryParse(ctx.Query.GetValueOrDefault("id"), out var id) || id <= 0)
|
||||
return null;
|
||||
|
||||
using var scope = sp.CreateScope();
|
||||
var service = scope.ServiceProvider.GetService<IFileStreamService>();
|
||||
if (service is null) return null;
|
||||
|
||||
return await service.GetFileStreamAsync(id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user