Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support delivery methods other than progressive HTTP #8153

Merged
merged 20 commits into from
Jun 22, 2022

Commits on Jun 17, 2022

  1. Add support of other delivery methods than progressive HTTP (in the p…

    …layer only)
    
    Detailed changes:
    
    - External players:
    
      - Add a message instruction about stream selection;
      - Add a message when there is no stream available for external players;
      - Return now HLS, DASH and SmoothStreaming URL contents, in addition to progressive HTTP ones.
    
    - Player:
    
      - Support DASH, HLS and SmoothStreaming streams for videos, whether they are content URLs or the manifests themselves, in addition to progressive HTTP ones;
      - Use a custom HttpDataSource to play YouTube contents, based of ExoPlayer's default one, which allows better spoofing of official clients (custom user-agent and headers (depending of the client used), use of range and rn (set dynamically by the DataSource) parameters);
      - Fetch YouTube progressive contents as DASH streams, like official clients, support fully playback of livestreams which have ended recently and OTF streams;
      - Use ExoPlayer's default retries count for contents on non-fatal errors (instead of Integer.MAX_VALUE for non-live contents and 5 for live contents).
    
    - Download dialog:
    
      - Add message about support of progressive HTTP streams only for downloading;
      - Remove several duplicated code and update relevant usages;
      - Support downloading of contents with an unknown media format.
    
    - ListHelper:
    
      - Catch NumberFormatException when trying to compare two video streams between them.
    
    - Tests:
    
      - Update ListHelperTest and StreamItemAdapterTest to fix breaking changes in the extractor.
    
    - Other places:
    
      - Fixes deprecation of changes made in the extractor;
      - Improve some code related to the files changed.
    
    - Issues fixed and/or improved with the changes:
    
      - Seeking of PeerTube HLS streams (the duration shown was the one from the stream duration and not the one parsed, incomplete because HLS streams are fragmented MP4s with multiple sidx boxes, for which seeking is not supported by ExoPlayer) (the app now uses the HLS manifest returned for each quality, in the master playlist (not fetched and computed by the extractor));
      - Crash when loading PeerTube streams with a separated audio;
      - Lack of some streams on some YouTube videos (OTF streams);
      - Loading times of YouTube streams, after a quality change or a playback start;
      - View count of YouTube ended livestreams interpreted as watching count (this type of streams is not interpreted anymore as livestreams);
      - Watchable time of YouTube ended livestreams;
      - Playback of SoundCloud HLS-only tracks (which cannot be downloaded anymore because the workaround which was used is being removed by SoundCloud, so it has been removed from the extractor).
    AudricV committed Jun 17, 2022
    Configuration menu
    Copy the full SHA
    210834f View commit details
    Browse the repository at this point in the history
  2. Improve dialog of streams for external players and fix use of the wro…

    …ng codec in the list of available streams in it after a codec change in Video and Audio settings
    
    The VideoDetailFragment will now get video streams dynamically instead of storing them as a field, so the good codec can be chosen by ListHelper.
    To select a stream to play, user has now to select the quality in the list of available qualities and then press the new OK button in the alert dialog.
    AudricV committed Jun 17, 2022
    Configuration menu
    Copy the full SHA
    7d6bf4b View commit details
    Browse the repository at this point in the history
  3. Move SimpleCache creation in PlayerDataSource to avoid an IllegalStat…

    …eException
    
    This IllegalStateException, almost not reproducible, indicates that another SimpleCache instance uses the cache folder, which was so trying to be created at least twice.
    Moving the SimpleCache creation in PlayerDataSource should avoid this exception.
    AudricV committed Jun 17, 2022
    Configuration menu
    Copy the full SHA
    fbee310 View commit details
    Browse the repository at this point in the history
  4. Move stream's cache key generation in PlaybackResolver and improve Pl…

    …aybackResolver's code
    Stypox authored and AudricV committed Jun 17, 2022
    Configuration menu
    Copy the full SHA
    ef20d9b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7ce2250 View commit details
    Browse the repository at this point in the history
  6. Add comments and use downloader user agent in YT data source

    YoutubeHttpDataSource
    Stypox authored and AudricV committed Jun 17, 2022
    Configuration menu
    Copy the full SHA
    fa46b7b View commit details
    Browse the repository at this point in the history
  7. Use DownloaderImpl.USER_AGENT directly

    instead of passing it as a parameter
    Stypox authored and AudricV committed Jun 17, 2022
    Configuration menu
    Copy the full SHA
    8445c38 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    e5ffa2a View commit details
    Browse the repository at this point in the history
  9. Code improvements here and there

    Stypox authored and AudricV committed Jun 17, 2022
    Configuration menu
    Copy the full SHA
    8dad6d7 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    73855ca View commit details
    Browse the repository at this point in the history
  11. Filter streams using Java 8 Stream's API instead of removing streams …

    …with list iterators and add a better toast when there is no audio stream for external players
    
    This ensures to not remove streams from the StreamInfo lists themselves, and so to not have to create list copies.
    
    The toast shown in RouterActivity, when there is no audio stream available for external players, is now shown, in the same case, when pressing the background button in VideoDetailFragment.
    AudricV committed Jun 17, 2022
    Configuration menu
    Copy the full SHA
    036196a View commit details
    Browse the repository at this point in the history
  12. Throw a dedicated exception when errors occur in PlaybackResolver

    A new exception, ResolverException, a subclass of PlaybackResolver, is now thrown when errors occur in PlaybackResolver, instead of an IOException
    AudricV committed Jun 17, 2022
    Configuration menu
    Copy the full SHA
    21c9530 View commit details
    Browse the repository at this point in the history
  13. Fix playback of non-URI HLS streams

    A custom HlsPlaylistParserFactory cannot be used anymore to play HLS streams.
    
    This needs to be replaced by a custom HlsDataSourceFactory, which returns a ByteArrayDataSource (where the bytes of this DataSource correspond to the bytes of the playlist string) and a specified DataSource for other request types.
    
    This model has two limitations:
    
    - if media requests are relative, the URI from which the manifest comes from (either the manifest URI (preferred) or the master URI (if applicable)) must be returned, otherwise the content will be not playable, as it will be an invalid URL, or it may be treat as something unexpected, for instance as a file for DefaultDataSources;
    - if the playlist is a master playlist, endless loops should be encountered because the DataSources created for media playlists will use the master playlist response instead of fetching the corresponding playlist. With the current model of HlsDataSourceFactory, there is no possibility to distinguish the playlist type or the URI that is requested.
    
    If ExoPlayer provides a way to create HlsMediaSources with an HlsPlaylist in the future, it should be used instead of this solution.
    AudricV committed Jun 17, 2022
    Configuration menu
    Copy the full SHA
    e3c2aea View commit details
    Browse the repository at this point in the history

Commits on Jun 18, 2022

  1. Configuration menu
    Copy the full SHA
    7ba7917 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4863084 View commit details
    Browse the repository at this point in the history
  3. Wrap debug log in if(DEBUG)

    Stypox committed Jun 18, 2022
    Configuration menu
    Copy the full SHA
    1e076ea View commit details
    Browse the repository at this point in the history
  4. Refactor PlaybackResolver and fix cacheKeyOf

    In commonCacheKeyOf the result of an Objects.hash() was ignored
    Stypox committed Jun 18, 2022
    Configuration menu
    Copy the full SHA
    2019af8 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4e87f5a View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    0ad6b3b View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2022

  1. Ensure that progressive contents are URL contents for playback

    A ResolverException will be now thrown otherwise.
    AudricV committed Jun 19, 2022
    Configuration menu
    Copy the full SHA
    cbd3308 View commit details
    Browse the repository at this point in the history