Это может быть обходной путь для вашей проблемы, но я использовал его в Exoplayer 2.6.1.Кроме того, Exoplayer 1.5.8 является устаревшей версией и содержит множество устаревших кодов.Последняя версия 2.8.1
final PopupMenu popupMenu = new PopupMenu(PlayerActivity.this, btn_settings);
popupMenu.getMenuInflater().inflate(R.menu.popup_menu, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
if (menuItem.getItemId() == R.id.Playback || menuItem.getItemId() == R.id.Quality) {
return true;
} else {
if (menuItem.getGroupId() == R.id.playbackGroup) {
// Was clicked on a sub menu item in playback sub menu
mExoPlayerView.getPlayer().setPlaybackParameters(new PlaybackParameters(playerSpeedSettings.get(menuItem.getItemId()), playerSpeedSettings.get(menuItem.getItemId())));
Toast.makeText(PlayerActivity.this, "" + menuItem.getTitle(), Toast.LENGTH_SHORT).show();
} else if (menuItem.getGroupId() == R.id.qualityGroup) {
// was clicked on a sub menu item in quality sub menu
Toast.makeText(PlayerActivity.this, "" + menuItem.getTitle(), Toast.LENGTH_SHORT).show();
// For selecting the Quality Tracks
MappingTrackSelector.MappedTrackInfo info = ((MappingTrackSelector) trackSelector).getCurrentMappedTrackInfo();
if (menuItem.getItemId() == R.id.onem) {
((DefaultTrackSelector) trackSelector).setSelectionOverride(0, info.getTrackGroups(0), new MappingTrackSelector.SelectionOverride(
new FixedTrackSelection.Factory(),
0,
2
));
} else if (menuItem.getItemId() == R.id.sixk) {
((DefaultTrackSelector) trackSelector).setSelectionOverride(0, info.getTrackGroups(0), new MappingTrackSelector.SelectionOverride(
new FixedTrackSelection.Factory(),
0,
1
));
} else if (menuItem.getItemId() == R.id.fourk) {
((DefaultTrackSelector) trackSelector).setSelectionOverride(0, info.getTrackGroups(0), new MappingTrackSelector.SelectionOverride(
new FixedTrackSelection.Factory(),
0,
0
));
} else {
((DefaultTrackSelector) trackSelector).setSelectionOverride(0, info.getTrackGroups(0), new MappingTrackSelector.SelectionOverride(
new AdaptiveTrackSelection.Factory(bandwidthMeter),
0,
0
));
Toast.makeText(PlayerActivity.this, "" + menuItem.getTitle(), Toast.LENGTH_SHORT).show();
}
}
}
return true;