负载在启动更高质量的平滑流码率(Load higher quality smooth streami

2019-10-18 18:30发布

是否有可能调整其流畅的流XAP比特率首次启动的方式吗? 因为它是现在,玩家表现出低质量的数据流,直到已经缓冲了更高的质量。 我可以改变这允许在启动更高质量的? 如果是这样,怎么样?

(我已经看到了这个问题,但我不使用媒体播放器的平台。)

IIS在启动平滑流低质量

Answer 1:

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.

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);
    }
}


文章来源: Load higher quality smooth streaming bitrate on start