From eea2768633883074aaecac0d4b078d96cc47eeb2 Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Sun, 19 Dec 2021 20:16:10 +0100 Subject: [PATCH 1/4] Removed/Reverted MediaParser support (Android 11+) due to bugs --- .../player/helper/PlayerDataSource.java | 51 +++---------------- 1 file changed, 8 insertions(+), 43 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerDataSource.java b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerDataSource.java index b7584151d..708b72ff2 100644 --- a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerDataSource.java +++ b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerDataSource.java @@ -1,18 +1,14 @@ package org.schabi.newpipe.player.helper; import android.content.Context; -import android.os.Build; import androidx.annotation.NonNull; -import com.google.android.exoplayer2.source.MediaParserExtractorAdapter; import com.google.android.exoplayer2.source.ProgressiveMediaSource; import com.google.android.exoplayer2.source.SingleSampleMediaSource; -import com.google.android.exoplayer2.source.chunk.MediaParserChunkExtractor; import com.google.android.exoplayer2.source.dash.DashMediaSource; import com.google.android.exoplayer2.source.dash.DefaultDashChunkSource; import com.google.android.exoplayer2.source.hls.HlsMediaSource; -import com.google.android.exoplayer2.source.hls.MediaParserHlsMediaChunkExtractor; import com.google.android.exoplayer2.source.smoothstreaming.DefaultSsChunkSource; import com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource; import com.google.android.exoplayer2.upstream.DataSource; @@ -46,17 +42,10 @@ public class PlayerDataSource { } public HlsMediaSource.Factory getLiveHlsMediaSourceFactory() { - final HlsMediaSource.Factory factory = - new HlsMediaSource.Factory(cachelessDataSourceFactory) - .setAllowChunklessPreparation(true) - .setLoadErrorHandlingPolicy( - new DefaultLoadErrorHandlingPolicy(MANIFEST_MINIMUM_RETRY)); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - factory.setExtractorFactory(MediaParserHlsMediaChunkExtractor.FACTORY); - } - - return factory; + return new HlsMediaSource.Factory(cachelessDataSourceFactory) + .setAllowChunklessPreparation(true) + .setLoadErrorHandlingPolicy( + new DefaultLoadErrorHandlingPolicy(MANIFEST_MINIMUM_RETRY)); } public DashMediaSource.Factory getLiveDashMediaSourceFactory() { @@ -71,26 +60,11 @@ public class PlayerDataSource { private DefaultDashChunkSource.Factory getDefaultDashChunkSourceFactory( final DataSource.Factory dataSourceFactory ) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - return new DefaultDashChunkSource.Factory( - MediaParserChunkExtractor.FACTORY, - dataSourceFactory, - 1 - ); - } - return new DefaultDashChunkSource.Factory(dataSourceFactory); } public HlsMediaSource.Factory getHlsMediaSourceFactory() { - final HlsMediaSource.Factory factory = new HlsMediaSource.Factory(cacheDataSourceFactory); - - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) { - return factory; - } - - // *** >= Android 11 / R / API 30 *** - return factory.setExtractorFactory(MediaParserHlsMediaChunkExtractor.FACTORY); + return new HlsMediaSource.Factory(cacheDataSourceFactory); } public DashMediaSource.Factory getDashMediaSourceFactory() { @@ -101,18 +75,9 @@ public class PlayerDataSource { } public ProgressiveMediaSource.Factory getExtractorMediaSourceFactory() { - final ProgressiveMediaSource.Factory factory; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - factory = new ProgressiveMediaSource.Factory( - cacheDataSourceFactory, - MediaParserExtractorAdapter.FACTORY - ); - } else { - factory = new ProgressiveMediaSource.Factory(cacheDataSourceFactory); - } - - return factory.setLoadErrorHandlingPolicy( - new DefaultLoadErrorHandlingPolicy(EXTRACTOR_MINIMUM_RETRY)); + return new ProgressiveMediaSource.Factory(cacheDataSourceFactory) + .setLoadErrorHandlingPolicy( + new DefaultLoadErrorHandlingPolicy(EXTRACTOR_MINIMUM_RETRY)); } public SingleSampleMediaSource.Factory getSampleMediaSourceFactory() { From 361760be0ac4304038457ca51aa135aa4bf6acaf Mon Sep 17 00:00:00 2001 From: Jaspann Date: Sun, 19 Dec 2021 20:33:55 -0500 Subject: [PATCH 2/4] Allows multilingual support in hashtags --- .../newpipe/util/external_communication/TextLinkifier.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/util/external_communication/TextLinkifier.java b/app/src/main/java/org/schabi/newpipe/util/external_communication/TextLinkifier.java index f435653b5..92bdf879d 100644 --- a/app/src/main/java/org/schabi/newpipe/util/external_communication/TextLinkifier.java +++ b/app/src/main/java/org/schabi/newpipe/util/external_communication/TextLinkifier.java @@ -33,7 +33,8 @@ import static org.schabi.newpipe.util.external_communication.InternalUrlsHandler public final class TextLinkifier { public static final String TAG = TextLinkifier.class.getSimpleName(); - private static final Pattern HASHTAGS_PATTERN = Pattern.compile("(#[A-Za-z0-9_]+)"); + private static final Pattern HASHTAGS_PATTERN = + Pattern.compile("(#[A-Za-z0-9_\\u0080-\\uFFFF]+)"); private TextLinkifier() { } From a274baf5cda538e03b9089752ba3dd936971ec64 Mon Sep 17 00:00:00 2001 From: Jaspann Date: Mon, 20 Dec 2021 14:13:40 -0500 Subject: [PATCH 3/4] Adds comment to HASHTAGS_PATTERN --- .../newpipe/util/external_communication/TextLinkifier.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/util/external_communication/TextLinkifier.java b/app/src/main/java/org/schabi/newpipe/util/external_communication/TextLinkifier.java index 92bdf879d..8b8eb265b 100644 --- a/app/src/main/java/org/schabi/newpipe/util/external_communication/TextLinkifier.java +++ b/app/src/main/java/org/schabi/newpipe/util/external_communication/TextLinkifier.java @@ -33,8 +33,9 @@ import static org.schabi.newpipe.util.external_communication.InternalUrlsHandler public final class TextLinkifier { public static final String TAG = TextLinkifier.class.getSimpleName(); + // Looks for hashtags with characters from any language (\p{L}), numbers, or underscores private static final Pattern HASHTAGS_PATTERN = - Pattern.compile("(#[A-Za-z0-9_\\u0080-\\uFFFF]+)"); + Pattern.compile("(#[\\p{L}0-9_]+)"); private TextLinkifier() { } From f3edc698973f94af0887c06da7b974690a8ae659 Mon Sep 17 00:00:00 2001 From: TobiGr Date: Thu, 5 Aug 2021 14:52:50 +0200 Subject: [PATCH 4/4] Fix incorrect link in Japanese README --- README.ja.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.ja.md b/README.ja.md index 5d9d46f75..2deab555c 100644 --- a/README.ja.md +++ b/README.ja.md @@ -17,7 +17,7 @@

ウェブサイトブログFAQニュース


-*他の言語で読む: [English](README.md), [Español](README.es.md), [한국어](README.ko.md), [Soomaali](README.so.md), [Português Brasil](README.pt.br.md), [日本語](README.ja.md), [Română](README.ro.md), [Türkçe](README.tr.md)。* +*他の言語で読む: [English](README.md), [Español](README.es.md), [한국어](README.ko.md), [Soomaali](README.so.md), [Português Brasil](README.pt_BR.md), [日本語](README.ja.md), [Română](README.ro.md), [Türkçe](README.tr.md)。* 注意: これはベータ版のため、バグが発生する可能性があります。もしバグが発生した場合、GitHub のリポジトリで Issue を開いてください。