add endpoint to estimate bitrate

pull/702/head
Luke Pulverenti 10 years ago
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&lt;System.Int32&gt;.</returns>
Task<int> GetSupportedBitrate(CancellationToken cancellationToken);
}
}
Loading…
Cancel
Save