-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
274 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 1 addition & 4 deletions
5
Example/DownloadToGo.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>BuildSystemType</key> | ||
<string>Original</string> | ||
</dict> | ||
<dict/> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
// | ||
// TestTools.swift | ||
// DownloadToGo | ||
// | ||
// Created by Noam Tamim on 17/03/2019. | ||
// Copyright © 2019 CocoaPods. All rights reserved. | ||
// | ||
|
||
import PlayKit | ||
import PlayKitProviders | ||
import DownloadToGo | ||
|
||
let setSmallerOfflineDRMExpirationMinutes: Int? = 5 | ||
//let setSmallerOfflineDRMExpirationMinutes: Int? = nil | ||
|
||
|
||
let defaultEnv = "http://cdnapi.kaltura.com" | ||
|
||
struct ItemJSON: Codable { | ||
let id: String | ||
let title: String? | ||
let partnerId: Int? | ||
let ks: String? | ||
let env: String = defaultEnv | ||
|
||
let url: String? | ||
|
||
let options: OptionsJSON? | ||
|
||
let expected: ExpectedValues? | ||
} | ||
|
||
struct ExpectedValues: Codable { | ||
let estimatedSize: Int64? | ||
let downloadedSize: Int64? | ||
let audioLangs: [String]? | ||
let textLangs: [String]? | ||
} | ||
|
||
struct OptionsJSON: Codable { | ||
let audioLangs: [String]? | ||
let allAudioLangs: Bool? | ||
let textLangs: [String]? | ||
let allTextLangs: Bool? | ||
let videoCodecs: [String]? | ||
let audioCodecs: [String]? | ||
let videoWidth: Int? | ||
let videoHeight: Int? | ||
let videoBitrates: [String:Int]? | ||
let allowInefficientCodecs: Bool? | ||
|
||
func toOptions() -> DTGSelectionOptions { | ||
let opts = DTGSelectionOptions() | ||
|
||
opts.allAudioLanguages = allAudioLangs ?? false | ||
opts.audioLanguages = audioLangs | ||
|
||
opts.allTextLanguages = allTextLangs ?? false | ||
opts.textLanguages = textLangs | ||
|
||
opts.allowInefficientCodecs = allowInefficientCodecs ?? false | ||
|
||
if let codecs = audioCodecs { | ||
opts.audioCodecs = codecs.compactMap({ (tag) -> DTGSelectionOptions.AudioCodec? in | ||
switch tag { | ||
case "mp4a": return .mp4a | ||
case "ac3": return .ac3 | ||
case "eac3", "ec3": return .eac3 | ||
default: return nil | ||
} | ||
}) | ||
} | ||
|
||
if let codecs = videoCodecs { | ||
opts.videoCodecs = codecs.compactMap({ (tag) -> DTGSelectionOptions.VideoCodec? in | ||
switch tag { | ||
case "avc1": return .avc1 | ||
case "hevc", "hvc1": return .hevc | ||
default: return nil | ||
} | ||
}) | ||
} | ||
|
||
opts.videoWidth = videoWidth | ||
opts.videoHeight = videoHeight | ||
|
||
if let bitrates = videoBitrates { | ||
for (codecId, bitrate) in bitrates { | ||
let codec: DTGSelectionOptions.VideoCodec | ||
switch codecId { | ||
case "avc1": codec = .avc1 | ||
case "hevc", "hvc1": codec = .hevc | ||
default: continue | ||
} | ||
|
||
opts.setMinVideoBitrate(codec, bitrate) | ||
} | ||
} | ||
|
||
return opts | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.