mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
Merge pull request #1902 from FireMasterK/otf-videos-fix
Implement proper handling of OTF videos.
This commit is contained in:
commit
1d08e30065
@ -1193,13 +1193,18 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
||||
if (!PreferenceHelper.getBoolean(PreferenceKeys.USE_HLS_OVER_DASH, false) &&
|
||||
streams.videoStreams.orEmpty().isNotEmpty()
|
||||
) {
|
||||
val manifest = DashHelper.createManifest(streams)
|
||||
val uri = let {
|
||||
streams.dash?.toUri()
|
||||
|
||||
// encode to base64
|
||||
val encoded = Base64.encodeToString(manifest.toByteArray(), Base64.DEFAULT)
|
||||
val mediaItem = "data:application/dash+xml;charset=utf-8;base64,$encoded"
|
||||
val manifest = DashHelper.createManifest(streams)
|
||||
|
||||
this.setMediaSource(mediaItem.toUri(), MimeTypes.APPLICATION_MPD)
|
||||
// encode to base64
|
||||
val encoded = Base64.encodeToString(manifest.toByteArray(), Base64.DEFAULT)
|
||||
|
||||
"data:application/dash+xml;charset=utf-8;base64,$encoded".toUri()
|
||||
}
|
||||
|
||||
this.setMediaSource(uri, MimeTypes.APPLICATION_MPD)
|
||||
} else if (streams.hls != null) {
|
||||
setMediaSource(streams.hls.toUri(), MimeTypes.APPLICATION_M3U8)
|
||||
} else {
|
||||
|
@ -45,6 +45,11 @@ object DashHelper {
|
||||
continue
|
||||
}
|
||||
|
||||
// ignore streams which might be OTF
|
||||
if (stream.indexEnd!! <= 0) {
|
||||
continue
|
||||
}
|
||||
|
||||
val adapSetInfo = adapSetInfos.find { it.mimeType == stream.mimeType }
|
||||
if (adapSetInfo != null) {
|
||||
adapSetInfo.formats.add(stream)
|
||||
|
Loading…
Reference in New Issue
Block a user