admin管理员组文章数量:1127588
I'm using AdaptiveMediaSource
to play HLS streamed video, however the player seems to want to download about 4 minutes worth of video segments as soon as it can before calming down and then only downloading new segments at the rate that the player plays them. This will put more pressure on my server than I'd like, is there a way to limit this? None of the properties on that class seem to effect this.
I did try adding a delay into a DownloadRequested
event handler to add a delay into the process if the media players position was sufficiently outside of the pending segments range, along the lines of:
private async void MediaSource_DownloadRequested(AdaptiveMediaSource sender, AdaptiveMediaSourceDownloadRequestedEventArgs args)
{
...
if (args.ResourceType == AdaptiveMediaSourceResourceType.MediaSegment)
{
...
AdaptiveMediaSourceDownloadRequestedDeferral deferral = args.GetDeferral();
await Task.Delay(TimeSpan.FromSeconds(1.0));
deferral.Complete();
...
}
}
which did throttle the requests, but also seemed to effect the internal download/playback bitrate calculations and the video quality switches down to the lowest available.
本文标签: cThrottling AdaptiveMediaSourceStack Overflow
版权声明:本文标题:c# - Throttling AdaptiveMediaSource - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736696275a1948195.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论