From 419e8991c93bc64cb0a977917a18e8a6e74939a7 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Mon, 11 Jul 2022 15:30:32 +0200 Subject: [PATCH] Fix parsing Piped streams --- Model/Applications/PipedAPI.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Model/Applications/PipedAPI.swift b/Model/Applications/PipedAPI.swift index 047938a6..ee40b353 100644 --- a/Model/Applications/PipedAPI.swift +++ b/Model/Applications/PipedAPI.swift @@ -488,8 +488,14 @@ final class PipedAPI: Service, ObservableObject, VideosAPI { let videoStreams = compatibleVideoStream(from: content) videoStreams.forEach { videoStream in - let audioAsset = AVURLAsset(url: audioStream.dictionaryValue["url"]!.url!) - let videoAsset = AVURLAsset(url: videoStream.dictionaryValue["url"]!.url!) + guard let audioAssetUrl = audioStream.dictionaryValue["url"]?.url, + let videoAssetUrl = videoStream.dictionaryValue["url"]?.url + else { + return + } + + let audioAsset = AVURLAsset(url: audioAssetUrl) + let videoAsset = AVURLAsset(url: videoAssetUrl) let videoOnly = videoStream.dictionaryValue["videoOnly"]?.boolValue ?? true let resolution = Stream.Resolution.from(resolution: videoStream.dictionaryValue["quality"]!.stringValue)