在ExoPlayer 2.18.5中,getCurrentMappedTrackInfo()函数已经被弃用并移除了。替代它的是getTrackGroups()和getTrackSelections()函数。这两个函数返回的是TrackGroupArray和TrackSelectionArray对象,可以通过它们获取当前播放的媒体的所有轨道信息。

例如,可以使用以下代码获取当前播放的视频的所有轨道信息:

TrackGroupArray trackGroups = player.getCurrentTrackGroups();
TrackSelectionArray trackSelections = player.getCurrentTrackSelections();
if (trackGroups != null && trackSelections != null) {
    for (int i = 0; i < trackGroups.length; i++) {
        TrackGroup trackGroup = trackGroups.get(i);
        TrackSelection trackSelection = trackSelections.get(i);
        // Do something with the track group and track selection
    }
}
exoplayer 2185 中 getCurrentMappedTrackInfo 函数不见了 怎么替代

原文地址: https://www.cveoy.top/t/topic/bW8j 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录