Skip to content

Commit

Permalink
Load poster image for video on background thread
Browse files Browse the repository at this point in the history
  • Loading branch information
mathebox committed Jan 23, 2024
1 parent 676609d commit b2d98f1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions iOS/Extensions/Binge+Video.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ extension BingePlayerViewController {
}

if let posterImageURL = video.item?.section?.course?.imageURL {
DispatchQueue.main.async {
DispatchQueue.global(qos: .userInitiated).async {
if let imageData = try? Data(contentsOf: posterImageURL), let image = UIImage(data: imageData) {
self.posterImage = image
DispatchQueue.main.async {
self.posterImage = image
}
}
}
}
Expand Down

0 comments on commit b2d98f1

Please sign in to comment.