Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Commenting code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon-T committed Jul 7, 2021
1 parent 0368652 commit 6a48f8d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Client/Frontend/Browser/PlaylistHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ class PlaylistHelper: NSObject, TabContentScript {
return isPlayable
}

// Performance improvement to check the status first
// before attempting to load the playable status
if isAssetPlayable() {
DispatchQueue.main.async {
completion(true)
Expand All @@ -148,9 +150,13 @@ class PlaylistHelper: NSObject, TabContentScript {
case .offline, .unknown:
log.error("Couldn't load asset's playability -- Offline")
DispatchQueue.main.async {
completion(isAssetPlayable())
// We have no other way of knowing the playable status
// It is best to assume the item can be played
// In the worst case, if it can't be played, it will show an error
completion(true)
}
case .online:
// Fetch the playable status asynchronously
asset?.loadValuesAsynchronously(forKeys: ["playable"]) {
DispatchQueue.main.async {
completion(isAssetPlayable())
Expand Down

0 comments on commit 6a48f8d

Please # to comment.