Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEM-2746 Fix download of audio-only assets #53

Merged
merged 1 commit into from
Nov 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Sources/HLSLocalizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class HLSLocalizer {
try save(text: localMaster.joined(separator: "\n") + "\n", as: MASTER_PLAYLIST_NAME)

// Localize the selected video stream
try saveMediaPlaylist(videoStream)
try saveMediaPlaylist(videoStream, forceVideo: true)

// Localize the selected audio and text streams
for stream in selectedAudioStreams {
Expand Down Expand Up @@ -175,11 +175,11 @@ class HLSLocalizer {
return line.hasPrefix("#EXT-X-SESSION-KEY:") && line.contains(KEYFORMAT_FAIRPLAY)
}

private func saveMediaPlaylist<T>(_ stream: Stream<T>) throws {
private func saveMediaPlaylist<T>(_ stream: Stream<T>, forceVideo: Bool = false) throws {
let mediaPlaylist = stream.mediaPlaylist
let originalUrl = stream.mediaUrl
let mapUrl = stream.mapUrl
let type = stream.trackType
let type = forceVideo ? DownloadItemTaskType.video : stream.trackType

guard let originalText = mediaPlaylist.originalText else { throw HLSLocalizerError.invalidState }
#if DEBUG
Expand Down
2 changes: 1 addition & 1 deletion Sources/HLSLocalizerUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class VideoStream: Stream<M3U8ExtXStreamInf>, CustomStringConvertible {
return M3U8_EXT_X_STREAM_INF +
attribs.map { $0 + "=" + $1 }.joined(separator: ",") +
"\n" +
self.mediaUrl.mediaPlaylistRelativeLocalPath(as: self.trackType)
self.mediaUrl.mediaPlaylistRelativeLocalPath(as: .video)
}
}

Expand Down