player: live format load refactor & dash segments recreate fix

This commit is contained in:
Yuriy Liskov
2022-08-18 09:46:23 +03:00
parent bc5d36d6d2
commit f5a99609ca
3 changed files with 20 additions and 7 deletions

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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"