From cbd3308da643e2649e1e01c820cfa7a5fde7fcd1 Mon Sep 17 00:00:00 2001 From: AudricV <74829229+AudricV@users.noreply.github.com> Date: Sun, 19 Jun 2022 15:27:30 +0200 Subject: [PATCH] Ensure that progressive contents are URL contents for playback A ResolverException will be now thrown otherwise. --- .../schabi/newpipe/player/resolver/PlaybackResolver.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/resolver/PlaybackResolver.java b/app/src/main/java/org/schabi/newpipe/player/resolver/PlaybackResolver.java index fb6dbc3bb..34e7e9bd1 100644 --- a/app/src/main/java/org/schabi/newpipe/player/resolver/PlaybackResolver.java +++ b/app/src/main/java/org/schabi/newpipe/player/resolver/PlaybackResolver.java @@ -249,6 +249,9 @@ public interface PlaybackResolver extends Resolver { final Stream stream, final String cacheKey, final MediaItemTag metadata) throws ResolverException { + if (!stream.isUrl()) { + throw new ResolverException("Non URI progressive contents are not supported"); + } throwResolverExceptionIfUrlNullOrEmpty(stream.getContent()); return dataSource.getProgressiveMediaSourceFactory().createMediaSource( new MediaItem.Builder() @@ -503,9 +506,9 @@ public interface PlaybackResolver extends Resolver { private static void throwResolverExceptionIfUrlNullOrEmpty(@Nullable final String url) throws ResolverException { if (url == null) { - throw new ResolverException("Null stream url"); + throw new ResolverException("Null stream URL"); } else if (url.isEmpty()) { - throw new ResolverException("Empty stream url"); + throw new ResolverException("Empty stream URL"); } } //endregion