在启动时加载更高质量的平滑流比特率 [英] Load higher quality smooth streaming bitrate on start
问题描述
是否可以调整首次启动平滑流xap比特率的方式?目前,播放器显示的是低质量的流,直到缓冲了较高的质量为止.我可以更改此设置以在启动时获得更高的质量吗?如果可以,怎么办?
Is it possible to adjust the way in which smooth streaming xap bitrate is first started? As it is right now, the player shows a low quality stream until is has buffered the higher quality. Can I change this to allow for the higher quality on start? If so, how?
(我已经看过这个问题,但是我没有使用媒体平台播放器.)
(I've already seen this question, but I am not using the media platform player.)
推荐答案
The answer on you link answers your question. All that you need is to replace the plugin by properties and events of the SmoothStreamingMediaElement class.
尽管我不喜欢这种实现方式,但msdn有一个更好的例子 选择并监视比特率
Though I don't like that implementation and msdn has a better example Select and Monitor Bitrate
因此,为了使质量高于平均水平,请使用以下代码:
So in order to set the quality above average use this code:
public MainPage()
{
InitializeComponent();
mediaElement.ManifestReady += OnManifestReady;
}
void OnManifestReady(object sender, EventArgs e)
{
foreach (SegmentInfo segment in mediaElement.ManifestInfo.Segments)
{
var videoStream = segment.AvailableStreams.First(i => i.Type == MediaStreamType.Video);
var averageBitrate = videoStream.AvailableTracks.Average(t => (double)t.Bitrate); // you can use Max as well
var allowedTracks = videoStream.AvailableTracks.Where(ti => ti.Bitrate >= averageBitrate).ToList();
videoStream.SelectTracks(allowedTracks, false);
}
}
这篇关于在启动时加载更高质量的平滑流比特率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!