mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 06:40: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) &&
|
if (!PreferenceHelper.getBoolean(PreferenceKeys.USE_HLS_OVER_DASH, false) &&
|
||||||
streams.videoStreams.orEmpty().isNotEmpty()
|
streams.videoStreams.orEmpty().isNotEmpty()
|
||||||
) {
|
) {
|
||||||
|
val uri = let {
|
||||||
|
streams.dash?.toUri()
|
||||||
|
|
||||||
val manifest = DashHelper.createManifest(streams)
|
val manifest = DashHelper.createManifest(streams)
|
||||||
|
|
||||||
// encode to base64
|
// encode to base64
|
||||||
val encoded = Base64.encodeToString(manifest.toByteArray(), Base64.DEFAULT)
|
val encoded = Base64.encodeToString(manifest.toByteArray(), Base64.DEFAULT)
|
||||||
val mediaItem = "data:application/dash+xml;charset=utf-8;base64,$encoded"
|
|
||||||
|
|
||||||
this.setMediaSource(mediaItem.toUri(), MimeTypes.APPLICATION_MPD)
|
"data:application/dash+xml;charset=utf-8;base64,$encoded".toUri()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setMediaSource(uri, MimeTypes.APPLICATION_MPD)
|
||||||
} else if (streams.hls != null) {
|
} else if (streams.hls != null) {
|
||||||
setMediaSource(streams.hls.toUri(), MimeTypes.APPLICATION_M3U8)
|
setMediaSource(streams.hls.toUri(), MimeTypes.APPLICATION_M3U8)
|
||||||
} else {
|
} else {
|
||||||
|
@ -45,6 +45,11 @@ object DashHelper {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore streams which might be OTF
|
||||||
|
if (stream.indexEnd!! <= 0) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
val adapSetInfo = adapSetInfos.find { it.mimeType == stream.mimeType }
|
val adapSetInfo = adapSetInfos.find { it.mimeType == stream.mimeType }
|
||||||
if (adapSetInfo != null) {
|
if (adapSetInfo != null) {
|
||||||
adapSetInfo.formats.add(stream)
|
adapSetInfo.formats.add(stream)
|
||||||
|
Loading…
Reference in New Issue
Block a user