예제 #1
0
        // User controls
        private void UpdateButtonVisibilities()
        {
            debugRootView.RemoveAllViews();
            if (player == null)
            {
                return;
            }

            MappedTrackInfo mappedTrackInfo = trackSelector.CurrentMappedTrackInfo;

            if (mappedTrackInfo == null)
            {
                return;
            }

            for (int i = 0; i < mappedTrackInfo.RendererCount; i++)
            {
                TrackGroupArray trackGroups = mappedTrackInfo.GetTrackGroups(i);
                if (trackGroups.Length != 0)
                {
                    Button button = new Button(this);
                    int    label;
                    switch (player.GetRendererType(i))
                    {
                    case C.TrackTypeAudio:
                        label = Resource.String.exo_track_selection_title_audio;
                        break;

                    case C.TrackTypeVideo:
                        label = Resource.String.exo_track_selection_title_video;
                        break;

                    case C.TrackTypeText:
                        label = Resource.String.exo_track_selection_title_text;
                        break;

                    default:
                        continue;
                    }
                    button.SetText(label);
                    button.SetTag(button.Id, i);
                    button.SetOnClickListener(this);
                    debugRootView.AddView(button);
                }
            }
        }
예제 #2
0
 public override void OnTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections)
 {
     activity.UpdateButtonVisibilities();
     if (trackGroups != activity.lastSeenTrackGroupArray)
     {
         MappedTrackInfo mappedTrackInfo = activity.trackSelector.CurrentMappedTrackInfo;
         if (mappedTrackInfo != null)
         {
             if (mappedTrackInfo.GetTypeSupport(C.TrackTypeVideo)
                 == MappedTrackInfo.RendererSupportUnsupportedTracks)
             {
                 activity.ShowToast(Resource.String.error_unsupported_video);
             }
             if (mappedTrackInfo.GetTypeSupport(C.TrackTypeAudio)
                 == MappedTrackInfo.RendererSupportUnsupportedTracks)
             {
                 activity.ShowToast(Resource.String.error_unsupported_audio);
             }
         }
         activity.lastSeenTrackGroupArray = trackGroups;
     }
 }
예제 #3
0
        // OnClickListener methods

        public void OnClick(View view)
        {
            if (view.Parent == debugRootView)
            {
                MappedTrackInfo mappedTrackInfo = trackSelector.CurrentMappedTrackInfo;
                if (mappedTrackInfo != null)
                {
                    string title                   = ((Button)view).Text;
                    int    rendererIndex           = (int)view.GetTag(view.Id);
                    int    rendererType            = mappedTrackInfo.GetRendererType(rendererIndex);
                    bool   allowAdaptiveSelections =
                        rendererType == C.TrackTypeVideo ||
                        (rendererType == C.TrackTypeAudio &&
                         mappedTrackInfo.GetTypeSupport(C.TrackTypeVideo)
                         == MappedTrackInfo.RendererSupportNoTracks);
                    Pair dialogPair = TrackSelectionView.GetDialog(this, title, trackSelector, rendererIndex);

                    ((TrackSelectionView)dialogPair.Second).SetShowDisableOption(true);
                    ((TrackSelectionView)dialogPair.Second).SetAllowAdaptiveSelections(allowAdaptiveSelections);
                    ((AlertDialog)dialogPair.First).Show();
                }
            }
        }