创建 ExoPlayer 轨道选择器对话框时出错

问题描述

   public TrackSelectionViewFragment() {
      // Retain instance across activity re-creation to prevent losing access to init data.
      setRetainInstance(true);
    }

    public void init(
            MappedTrackInfo mappedTrackInfo,int rendererIndex,boolean initialIsdisabled,@Nullable SelectionOverride initialoverride,boolean allowAdaptiveSelections,boolean allowMultipleOverrides) {
      this.mappedTrackInfo = mappedTrackInfo;
      this.rendererIndex = rendererIndex;
      this.isdisabled = initialIsdisabled;
      this.overrides =
              initialoverride == null
                      ? Collections.emptyList()
                      : Collections.singletonList(initialoverride);
      this.allowAdaptiveSelections = allowAdaptiveSelections;
      this.allowMultipleOverrides = allowMultipleOverrides;
    }

    @Nullable
    @Override
    public View onCreateView(
            LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState) {
      View rootView =
              inflater.inflate(
                      R.layout.exo_track_selection_dialog,container,/* attachToRoot= */ false);
      TrackSelectionView trackSelectionView = rootView.findViewById(R.id.exo_track_selection_view);
      trackSelectionView.setShowdisableOption(true);
      trackSelectionView.setAllowMultipleOverrides(allowMultipleOverrides);
      trackSelectionView.setAllowAdaptiveSelections(allowAdaptiveSelections);
      trackSelectionView.init(
              mappedTrackInfo,rendererIndex,isdisabled,overrides,this);
      return rootView;
    }

    @Override
    public void onTrackSelectionChanged(boolean isdisabled,List<SelectionOverride> overrides) {
      this.isdisabled = isdisabled;
      this.overrides = overrides;
    }
  }

这是我制作曲目选择器对话框的代码 但我在 trackSelectionView.init( mappingTrackInfo,this);

需要 trackFormatComparator 来填充参数,现在只有 5 个参数

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)