diff --git a/Sources/Player/PlaybackEngine/Internal/PlaybackSource.swift b/Sources/Player/PlaybackEngine/Internal/PlaybackSource.swift index 17b16191..6d28a5ed 100644 --- a/Sources/Player/PlaybackEngine/Internal/PlaybackSource.swift +++ b/Sources/Player/PlaybackEngine/Internal/PlaybackSource.swift @@ -4,4 +4,13 @@ enum PlaybackSource { case INTERNET case LOCAL_STORAGE case LOCAL_STORAGE_LEGACY + + func isOfflineSource() -> Bool { + switch self { + case .LOCAL_STORAGE, .LOCAL_STORAGE_LEGACY: + true + case .INTERNET: + false + } + } } diff --git a/Sources/Player/PlaybackEngine/Internal/PlayerItem.swift b/Sources/Player/PlaybackEngine/Internal/PlayerItem.swift index ecd07f0c..bf14e337 100644 --- a/Sources/Player/PlaybackEngine/Internal/PlayerItem.swift +++ b/Sources/Player/PlaybackEngine/Internal/PlayerItem.swift @@ -439,11 +439,12 @@ private extension PlayerItem { func emitOfflinePlay() { guard let metrics, + metrics.actualStartTime != nil, + let metadata, + metadata.playbackSource.isOfflineSource(), let playbackContext, - let asset, let productId = Int(playbackContext.productId), - metrics.actualStartTime != nil, - mediaProduct is StoredMediaProduct + let asset else { return }