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

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

问题描述

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

解决方案

您可以使用Exoplayer2中的音轨选择器功能来执行此操作-它实际上限制了播放器中的自适应比特率选择功能可以选择的音轨.

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

要只拥有一个曲目,您只允许该曲目.

此功能包含在演示中-这是他们其中一个博客中有关此内容的示例屏幕截图:

此处专门介绍了曲目选择的更多详细信息(也链接到Exoplyar GitHub页面): 解决方案

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:

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天全站免登陆