Skip to content

Commit

Permalink
Update YouTubeKit (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
waliid authored Aug 29, 2023
1 parent 7ab0615 commit 08800dd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Demo/Pillarbox-demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@
repositoryURL = "https://github.com/alexeichhorn/YouTubeKit";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.1.8;
minimumVersion = 0.1.9;
};
};
0EF42CB429AE513400553165 /* XCRemoteSwiftPackageReference "srgdataprovider-apple" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/alexeichhorn/YouTubeKit",
"state" : {
"revision" : "5d28558124d52668b0ab4236ad4bdbe69a80a10b",
"version" : "0.1.8"
"revision" : "8748eddb22c8ea78858fdb4653bd568054a0de1a",
"version" : "0.1.9"
}
}
],
Expand Down
7 changes: 4 additions & 3 deletions Demo/Sources/YouTube/PlayerItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ extension PlayerItem {
Future<URL, YouTubeError> { promise in
Task {
do {
let stream = try await YouTube(videoID: videoId)
.streams
let liveStream = try await YouTube(videoID: videoId).livestreams.first
let stream = try await YouTube(videoID: videoId).streams
.filter { $0.subtype == "mp4" && $0.includesVideoTrack }
.highestAudioBitrateStream()
guard let url = stream?.url else { return promise(.failure(.url)) }

guard let url = liveStream?.url ?? stream?.url else { return promise(.failure(.url)) }
return promise(.success(url))
}
catch {
Expand Down

0 comments on commit 08800dd

Please sign in to comment.