From 6a48f8df2f9b387630b60d8cff4599b75ce019db Mon Sep 17 00:00:00 2001 From: Brandon T Date: Mon, 14 Jun 2021 15:48:49 -0400 Subject: [PATCH] Commenting code. --- Client/Frontend/Browser/PlaylistHelper.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Client/Frontend/Browser/PlaylistHelper.swift b/Client/Frontend/Browser/PlaylistHelper.swift index 39abaa76cf6..c3ea7536e29 100644 --- a/Client/Frontend/Browser/PlaylistHelper.swift +++ b/Client/Frontend/Browser/PlaylistHelper.swift @@ -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) @@ -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())