Skip to content

Instantly share code, notes, and snippets.

@abhiint16
Created June 3, 2019 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save abhiint16/165449a1a7d1a55a8f69d23718c603c2 to your computer and use it in GitHub Desktop.
Save abhiint16/165449a1a7d1a55a8f69d23718c603c2 to your computer and use it in GitHub Desktop.
track_selection_text.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
MappingTrackSelector.MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
if (mappedTrackInfo != null) {
//CharSequence title = ((Button) view).getText();
//int rendererIndex = (int) v.getTag();
int rendererType = mappedTrackInfo.getRendererType(0);
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, TrackSelection> dialogPair = TrackSelection
.getDialog(activity, "Video", trackSelector, 0, VideoPlayer.this,
track_selection_text.getText().toString(), player.getVideoFormat());
dialogPair.second.setShowDisableOption(false);
dialogPair.second.setAllowAdaptiveSelections(allowAdaptiveSelections);
dialogPair.first.show();
}
}
});
@langaliamayank
Copy link

@langaliamayank

Each video that you play has to provide resolution list to show it to your user. You need to debug in MyTackSelection's updateViews() method and see for trackGroups.length. For you, it seems that the length is 0

Track length getting 1.

@AnuragRastogi1
Copy link

You'll have to open "exo_track_selection_view" XML and then change the package name (path name)to your custom TrackSelector.java
you'll find something like below in the XML

`

<X.Y.Z.TrackSelection
    android:id="@+id/exo_track_selection_init_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical" />

`

you need to change X.Y.Z.Trackselection to com.maxtv.activity.tv.TrackSelection

So if i am doing this , i am not able to set my player

@avimone
Copy link

avimone commented Jun 4, 2021

how to open exo_track_selection_dialog.xml and change to TrackSelection.
im getting this error
java.lang.ClassCastException: androidx.viewpager.widget.ViewPager cannot be cast to co.appmastery.worldbbtv.downloader.TrackSelection E/AndroidRuntime(30347): at co.appmastery.worldbbtv.downloader.TrackSelection.getDialog(TrackSelection.java:70) E/AndroidRuntime(30347): at co.appmastery.worldbbtv.PlayerActivity.test(PlayerActivity.java:909)

@Allan-Nava
Copy link

Any fix with the resoultion like youtube only 720 , 360 etc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment