Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into sponsorblock
Browse files Browse the repository at this point in the history
  • Loading branch information
polymorphicshade committed Dec 28, 2021
2 parents 877503c + ff8868f commit eb2ddd6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 46 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
resValue "string", "app_name", "NewPipe SponsorBlock"
minSdkVersion 19
targetSdkVersion 29
versionCode 980
versionName "0.21.14"
versionCode 981
versionName "0.21.15"

multiDexEnabled true

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -46,17 +42,10 @@ public SsMediaSource.Factory getLiveSsMediaSourceFactory() {
}

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() {
Expand All @@ -71,26 +60,11 @@ public DashMediaSource.Factory getLiveDashMediaSourceFactory() {
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() {
Expand All @@ -101,18 +75,9 @@ public DashMediaSource.Factory getDashMediaSourceFactory() {
}

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() {
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public final class DeviceUtils {
// Hilife TV
private static final boolean REALTEKATV = Build.VERSION.SDK_INT == 25
&& Build.DEVICE.equals("RealtekATV");
// Philips QM16XE
private static final boolean QM16XE_U = Build.VERSION.SDK_INT == 23
&& Build.DEVICE.equals("QM16XE_U");

private DeviceUtils() {
}
Expand Down Expand Up @@ -134,7 +137,8 @@ public static boolean shouldSupportMediaTunneling() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
&& !HI3798MV200
&& !CVT_MT5886_EU_1G
&& !REALTEKATV;
&& !REALTEKATV
&& !QM16XE_U;
}

public static boolean isLandscape(final Context context) {
Expand Down
2 changes: 2 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/981.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Removed MediaParser support to fix failing playback resume after buffering on Android 11+.
Disabled media tunneling on Philips QM16XE to fix playback problems.

0 comments on commit eb2ddd6

Please sign in to comment.