diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/playback/managers/VideoLoaderManager.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/playback/managers/VideoLoaderManager.java index f7f497451..45e2ef57e 100644 --- a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/playback/managers/VideoLoaderManager.java +++ b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/playback/managers/VideoLoaderManager.java @@ -246,19 +246,18 @@ public class VideoLoaderManager extends PlayerEventListenerHelper { } private void processFormatInfo(MediaItemFormatInfo formatInfo) { - boolean isLive = formatInfo.isLive() || formatInfo.isLiveContent(); String bgImageUrl = null; if (formatInfo.isUnplayable()) { getController().showError(formatInfo.getPlayabilityStatus()); bgImageUrl = mLastVideo.getBackgroundUrl(); - } else if (formatInfo.containsDashUrl() && isLive && !PlayerTweaksData.instance(getActivity()).isLiveStreamFixEnabled()) { + } else if (formatInfo.containsDashUrl() && !forceLegacyFormat(formatInfo)) { Log.d(TAG, "Found live video (current or past live stream) in dash format. Loading..."); getController().openDashUrl(formatInfo.getDashManifestUrl()); - } else if (formatInfo.containsHlsUrl() && isLive) { + } else if (formatInfo.containsHlsUrl()) { Log.d(TAG, "Found live video (current or past live stream) in hls format. Loading..."); getController().openHlsUrl(formatInfo.getHlsManifestUrl()); - } else if (formatInfo.containsDashVideoInfo() && !mPlayerData.isLegacyCodecsForced()) { + } else if (formatInfo.containsDashVideoInfo() && !forceLegacyFormat(formatInfo)) { Log.d(TAG, "Found regular video in dash format. Loading..."); mMpdStreamAction = formatInfo.createMpdStreamObservable() @@ -433,4 +432,18 @@ public class VideoLoaderManager extends PlayerEventListenerHelper { Log.e(TAG, "Undetected repeat mode " + playbackMode); } + + private boolean forceLegacyFormat(MediaItemFormatInfo formatInfo) { + boolean isLive = formatInfo.isLive() || formatInfo.isLiveContent(); + + if (isLive && PlayerTweaksData.instance(getActivity()).isLiveStreamFixEnabled() && formatInfo.containsHlsUrl()) { + return true; + } + + if (!isLive && mPlayerData.isLegacyCodecsForced()) { + return true; + } + + return false; + } } diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/exoplayer/LiveDashManifestParser.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/exoplayer/LiveDashManifestParser.java index e5ae03e25..4be8098cc 100644 --- a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/exoplayer/LiveDashManifestParser.java +++ b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/exoplayer/LiveDashManifestParser.java @@ -201,7 +201,7 @@ public class LiveDashManifestParser extends DashManifestParser { } // Skip past streams that are truncated (truncated streams have a problems) - if (isNewStream && firstSegmentNum > segmentCount) { + if ((isNewStream || isPastStream) && firstSegmentNum > segmentCount) { return; } diff --git a/smarttubetv/build.gradle b/smarttubetv/build.gradle index cb9568e83..110968172 100644 --- a/smarttubetv/build.gradle +++ b/smarttubetv/build.gradle @@ -59,8 +59,8 @@ android { applicationId "com.liskovsoft.smarttubetv" minSdkVersion project.properties.minSdkVersion targetSdkVersion project.properties.targetSdkVersion - versionCode 777 - versionName "15.87" + versionCode 778 + versionName "15.88" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"