mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
Ignore unknown audio track types
Co-authored-by: AudricV <74829229+AudricV@users.noreply.github.com>
This commit is contained in:
parent
9d25d32bff
commit
df4df4fccc
@ -115,14 +115,18 @@ object DashHelper {
|
||||
adapSetElement.setAttribute("lang", adapSet.audioLocale)
|
||||
}
|
||||
|
||||
val roleElement = doc.createElement("Role")
|
||||
roleElement.setAttribute("schemeIdUri", "urn:mpeg:dash:role:2011")
|
||||
roleElement.setAttribute(
|
||||
"value",
|
||||
getRoleValueFromAudioTrackType(adapSet.audioTrackType)
|
||||
)
|
||||
|
||||
adapSetElement.appendChild(roleElement)
|
||||
// Only add the Role element if there is a track type set
|
||||
// This allows distinction between formats marked as original on YouTube and
|
||||
// formats without track type info set
|
||||
if (adapSet.audioTrackType != null) {
|
||||
val roleElement = doc.createElement("Role")
|
||||
roleElement.setAttribute("schemeIdUri", "urn:mpeg:dash:role:2011")
|
||||
roleElement.setAttribute(
|
||||
"value",
|
||||
getRoleValueFromAudioTrackType(adapSet.audioTrackType)
|
||||
)
|
||||
adapSetElement.appendChild(roleElement)
|
||||
}
|
||||
|
||||
val isVideo = adapSet.mimeType.contains("video")
|
||||
|
||||
@ -198,11 +202,7 @@ object DashHelper {
|
||||
return segmentBase
|
||||
}
|
||||
|
||||
private fun getRoleValueFromAudioTrackType(audioTrackType: String?): String {
|
||||
if (audioTrackType == null) {
|
||||
return "main"
|
||||
}
|
||||
|
||||
private fun getRoleValueFromAudioTrackType(audioTrackType: String): String {
|
||||
return when (audioTrackType.lowercase()) {
|
||||
"descriptive" -> "description"
|
||||
"dubbed" -> "dub"
|
||||
|
@ -1429,7 +1429,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
||||
}
|
||||
.show(childFragmentManager)
|
||||
}
|
||||
|
||||
|
||||
override fun onAudioStreamClicked() {
|
||||
val context = requireContext()
|
||||
val audioLanguagesAndRoleFlags = PlayerHelper.getAudioLanguagesAndRoleFlagsFromTrackGroups(
|
||||
|
Loading…
Reference in New Issue
Block a user