mirror of
https://github.com/yuliskov/SmartTube.git
synced 2026-02-09 08:11:19 -06:00
player: live format load refactor & dash segments recreate fix
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user