Class VideoTrackSelectionDialogFragment

All Implemented Interfaces:
ComponentCallbacks, ComponentCallbacks2, DialogInterface.OnCancelListener, DialogInterface.OnClickListener, DialogInterface.OnDismissListener, View.OnCreateContextMenuListener

public class VideoTrackSelectionDialogFragment extends AbstractSelectionDialog<VideoTrackAndQuality>
This is a utility class that allows you to create a DialogFragment that can be used to switch video tracks and qualities. See the various newInstance methods on how to customize the dialog.

Note that the hosting activity that starts the dialog should implement the PlayerViewProvider interface as the dialog needs to be able to access the underlying IPlayerView to retrieve its data and apply the selection even when the system disposes and recreates the dialog.

Since:
3.0.0
  • Constructor Details

    • VideoTrackSelectionDialogFragment

      public VideoTrackSelectionDialogFragment()
  • Method Details

    • newInstance

      public static VideoTrackSelectionDialogFragment newInstance(IPlayerView playerView, String title)
      Creates a new dialog fragment that shows the available tracks and qualities and allows selecting a new track and quality.

      By default, this dialog will allow to disable the video track.

      Parameters:
      playerView - The player view
      title - The dialog title
      Returns:
      The dialog fragment
    • newInstance

      public static VideoTrackSelectionDialogFragment newInstance(IPlayerView playerView, String title, boolean allowDisable)
      Creates a new dialog fragment that shows the available tracks and qualities and allows selecting a new track and quality.

      Parameters:
      playerView - The player view
      title - The dialog title
      allowDisable - If true, the dialog will allow to disable the video track.
      Returns:
      The dialog fragment
    • newInstance

      public static VideoTrackSelectionDialogFragment newInstance(IPlayerView playerView, String title, boolean allowDisable, Converter<VideoTrackAndQuality,String> converter)
      Creates a new dialog fragment that shows the available tracks and qualities and allows selecting a new track and quality.

      Parameters:
      playerView - The playerView
      title - The dialog title
      allowDisable - If true, the dialog will allow to disable the video track.
      converter - The converter that is used to translate VideoTrackAndQuality instanced to Strings that are used as labels in the dialog. Note that the converter should translate null to the string representation of the "disable" item if allowDisable is set to true.
      Returns:
      The dialog fragment
    • onCreateDialog

      @NonNull public Dialog onCreateDialog(Bundle savedInstanceState)
      Overrides:
      onCreateDialog in class AbstractSelectionDialog<VideoTrackAndQuality>