add endpoint to estimate bitrate
This commit is contained in:
parent
213182dd97
commit
a4e28a60a4
|
@ -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);
|
||||
|
|
|
@ -1499,5 +1499,11 @@ namespace MediaBrowser.Model.ApiClient
|
|||
/// <param name="itemIds">The item ids.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task CancelSyncLibraryItems(string targetId, IEnumerable<string> itemIds);
|
||||
/// <summary>
|
||||
/// Gets the supported bitrate.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task<System.Int32>.</returns>
|
||||
Task<int> GetSupportedBitrate(CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user