mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-27 19:24:47 +03:00
add endpoint to estimate bitrate
This commit is contained in:
@@ -45,6 +45,19 @@ namespace MediaBrowser.Api.Playback
|
||||
public string LiveStreamId { get; set; }
|
||||
}
|
||||
|
||||
[Route("/Playback/BitrateTest", "GET")]
|
||||
public class GetBitrateTestBytes : IReturn<PlaybackInfoResponse>
|
||||
{
|
||||
[ApiMember(Name = "Size", Description = "Size", IsRequired = true, DataType = "int", ParameterType = "query", Verb = "GET")]
|
||||
public long Size { get; set; }
|
||||
|
||||
public GetBitrateTestBytes()
|
||||
{
|
||||
// 100k
|
||||
Size = 102400;
|
||||
}
|
||||
}
|
||||
|
||||
[Authenticated]
|
||||
public class MediaInfoService : BaseApiService
|
||||
{
|
||||
@@ -63,6 +76,18 @@ namespace MediaBrowser.Api.Playback
|
||||
_networkManager = networkManager;
|
||||
}
|
||||
|
||||
public object Get(GetBitrateTestBytes request)
|
||||
{
|
||||
var bytes = new byte[request.Size];
|
||||
|
||||
for (var i = 0; i < bytes.Length; i++)
|
||||
{
|
||||
bytes[i] = 0;
|
||||
}
|
||||
|
||||
return ResultFactory.GetResult(bytes, "application/octet-stream");
|
||||
}
|
||||
|
||||
public async Task<object> Get(GetPlaybackInfo request)
|
||||
{
|
||||
var result = await GetPlaybackInfo(request.Id, request.UserId, new[] { MediaType.Audio, MediaType.Video }).ConfigureAwait(false);
|
||||
|
||||
Reference in New Issue
Block a user