Merge branch 'TeamNewPipe:dev' into dev

This commit is contained in:
Martin 2021-12-23 15:44:09 +01:00 committed by GitHub
commit 3e44856d01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 45 deletions

View File

@ -17,7 +17,7 @@
<p align="center"><a href="https://newpipe.net">ウェブサイト</a> &bull; <a href="https://newpipe.net/blog/">ブログ</a> &bull; <a href="https://newpipe.net/FAQ/">FAQ</a> &bull; <a href="https://newpipe.net/press/">ニュース</a></p> <p align="center"><a href="https://newpipe.net">ウェブサイト</a> &bull; <a href="https://newpipe.net/blog/">ブログ</a> &bull; <a href="https://newpipe.net/FAQ/">FAQ</a> &bull; <a href="https://newpipe.net/press/">ニュース</a></p>
<hr> <hr>
*他の言語で読む: [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)。*
<b>注意: これはベータ版のため、バグが発生する可能性があります。もしバグが発生した場合、GitHub のリポジトリで Issue を開いてください。</b> <b>注意: これはベータ版のため、バグが発生する可能性があります。もしバグが発生した場合、GitHub のリポジトリで Issue を開いてください。</b>

View File

@ -1,18 +1,14 @@
package org.schabi.newpipe.player.helper; package org.schabi.newpipe.player.helper;
import android.content.Context; import android.content.Context;
import android.os.Build;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.google.android.exoplayer2.source.MediaParserExtractorAdapter;
import com.google.android.exoplayer2.source.ProgressiveMediaSource; import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.source.SingleSampleMediaSource; 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.DashMediaSource;
import com.google.android.exoplayer2.source.dash.DefaultDashChunkSource; import com.google.android.exoplayer2.source.dash.DefaultDashChunkSource;
import com.google.android.exoplayer2.source.hls.HlsMediaSource; 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.DefaultSsChunkSource;
import com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource; import com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource;
import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DataSource;
@ -46,17 +42,10 @@ public class PlayerDataSource {
} }
public HlsMediaSource.Factory getLiveHlsMediaSourceFactory() { public HlsMediaSource.Factory getLiveHlsMediaSourceFactory() {
final HlsMediaSource.Factory factory = return new HlsMediaSource.Factory(cachelessDataSourceFactory)
new HlsMediaSource.Factory(cachelessDataSourceFactory)
.setAllowChunklessPreparation(true) .setAllowChunklessPreparation(true)
.setLoadErrorHandlingPolicy( .setLoadErrorHandlingPolicy(
new DefaultLoadErrorHandlingPolicy(MANIFEST_MINIMUM_RETRY)); new DefaultLoadErrorHandlingPolicy(MANIFEST_MINIMUM_RETRY));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
factory.setExtractorFactory(MediaParserHlsMediaChunkExtractor.FACTORY);
}
return factory;
} }
public DashMediaSource.Factory getLiveDashMediaSourceFactory() { public DashMediaSource.Factory getLiveDashMediaSourceFactory() {
@ -71,26 +60,11 @@ public class PlayerDataSource {
private DefaultDashChunkSource.Factory getDefaultDashChunkSourceFactory( private DefaultDashChunkSource.Factory getDefaultDashChunkSourceFactory(
final DataSource.Factory dataSourceFactory 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); return new DefaultDashChunkSource.Factory(dataSourceFactory);
} }
public HlsMediaSource.Factory getHlsMediaSourceFactory() { public HlsMediaSource.Factory getHlsMediaSourceFactory() {
final HlsMediaSource.Factory factory = new HlsMediaSource.Factory(cacheDataSourceFactory); return 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);
} }
public DashMediaSource.Factory getDashMediaSourceFactory() { public DashMediaSource.Factory getDashMediaSourceFactory() {
@ -101,17 +75,8 @@ public class PlayerDataSource {
} }
public ProgressiveMediaSource.Factory getExtractorMediaSourceFactory() { public ProgressiveMediaSource.Factory getExtractorMediaSourceFactory() {
final ProgressiveMediaSource.Factory factory; return new ProgressiveMediaSource.Factory(cacheDataSourceFactory)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { .setLoadErrorHandlingPolicy(
factory = new ProgressiveMediaSource.Factory(
cacheDataSourceFactory,
MediaParserExtractorAdapter.FACTORY
);
} else {
factory = new ProgressiveMediaSource.Factory(cacheDataSourceFactory);
}
return factory.setLoadErrorHandlingPolicy(
new DefaultLoadErrorHandlingPolicy(EXTRACTOR_MINIMUM_RETRY)); new DefaultLoadErrorHandlingPolicy(EXTRACTOR_MINIMUM_RETRY));
} }

View File

@ -33,7 +33,9 @@ import static org.schabi.newpipe.util.external_communication.InternalUrlsHandler
public final class TextLinkifier { public final class TextLinkifier {
public static final String TAG = TextLinkifier.class.getSimpleName(); public static final String TAG = TextLinkifier.class.getSimpleName();
private static final Pattern HASHTAGS_PATTERN = Pattern.compile("(#[A-Za-z0-9_]+)"); // Looks for hashtags with characters from any language (\p{L}), numbers, or underscores
private static final Pattern HASHTAGS_PATTERN =
Pattern.compile("(#[\\p{L}0-9_]+)");
private TextLinkifier() { private TextLinkifier() {
} }