是否可以手动更改 exoplayer 的分辨率? [英] Is it possible to change resolution of exoplayer manually?

查看:33
本文介绍了是否可以手动更改 exoplayer 的分辨率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个使用 Exoplayer2 进行 HLS 视频流传输的项目.自适应流在我的 exoplayer 中运行良好,但我想实现一个功能,用户可以从 UI 手动更改视频的分辨率(144p、240p、480p……).我从 TrackGroup API 获得了播放视频的分辨率.但是不知道如何手动将分辨率值设置到播放视频中.谢谢

I'm working on a project that use Exoplayer2 for HLS video streaming. Adaptive streaming is working well in my exoplayer, but i want to implement a feature that user can change the resolution (144p,240p,480p..)of the video manually from UI. I got the resolution of the playing video from TrackGroup API. But don't know how to set the resolution value into the playing video manually. Thanks

推荐答案

您可以使用 Exoplayer2 中的轨道选择器功能来做到这一点 - 它本质上限制了播放器中的自适应比特率选择功能可以从中选择的轨道.

You can do this using the track selector functionality in Exoplayer2 - it essentially limits the tracks that the adaptive bit rate selection functionality in the player can select from.

它只能从流索引文件,清单文件中的可用轨道中进行选择.因此,您对分辨率/比特率的选择仅限于流提供商提供的任何比特率、分辨率等 - 即用户不能只选择他们想要的任意比特率或分辨率,如果它不是其中之一清单文件(视频轨道索引文件)中可用的那些.

It can only select from the available tracks in the stream index file, the manifest file. Hence, your choice of resolutions/bit rates is limited to whatever bitrate, resolution etc the stream provider has made available - i.e. the user can't just choose an arbitrary bit rate or resolution that they would like, if it is not one of the available ones in the manifest file (the video track index file).

要只有一首曲目,您只需允许该曲目即可.

To have just one track you simply only allow that one.

此功能包含在演示中 - 以下是他们关于此的博客之一的示例屏幕截图:

This functionality is included in the demo - here is an example screen shot from one of their blogs about this:

这里有更多关于曲目选择的详细信息(它也来自 Exoplyar GitHub 页面):https://medium.com/google-exoplayer/exoplayer-2-x-track-selection-2b62ff712cc9

More details specifically on track selection here (it is also linked from the Exoplyar GitHub page): https://medium.com/google-exoplayer/exoplayer-2-x-track-selection-2b62ff712cc9

这篇关于是否可以手动更改 exoplayer 的分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆