在AndroidX上找不到TrackSelectionView .getDialog类。 但是v7Support Libraries可以正常工作。
错误:找不到符号方法getDialog(Activity,CharSequence,DefaultTrackSelector,int)
MappingTrackSelector.MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
if (mappedTrackInfo != null)
{
CharSequence title = string;
int rendererIndex = index;
int rendererType = mappedTrackInfo.getRendererType(rendererIndex);
boolean allowAdaptiveSelections =
rendererType == C.TRACK_TYPE_VIDEO || (rendererType == C.TRACK_TYPE_AUDIO &&
mappedTrackInfo.getTypeSupport(C.TRACK_TYPE_VIDEO) == MappingTrackSelector.MappedTrackInfo.RENDERER_SUPPORT_NO_TRACKS);
Pair<AlertDialog, TrackSelectionView> dialogPair = TrackSelectionView.getDialog((Activity) context, title, trackSelector, rendererIndex);
dialogPair.second.setShowDisableOption(non);
//dialogPair.second.setAllowAdaptiveSelections(allowAdaptiveSelections);
//Set the dialog to not focusable (makes navigation ignore us adding the window)
dialogPair.first.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
dialogPair.first.show();
dialogPair.first.getWindow().getDecorView().setSystemUiVisibility(((Activity) context).getWindow().getDecorView().getSystemUiVisibility());
//Clear the not focusable flag from the window
dialogPair.first.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
}
在TrackSelectionView .getDialog中找到exoplayer对话框轨道