From cc4b8d70b6c6ff69d0884ae829bcb0ae88f64c94 Mon Sep 17 00:00:00 2001 From: Jens Timmerman Date: Sun, 1 Nov 2020 03:27:38 +0100 Subject: [PATCH] prefer hls_aes streams over others --- vrtnu/vrtnu/ContentView.swift | 5 +++-- vrtnu/vrtnu/VrtNuLayout.swift | 11 ++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/vrtnu/vrtnu/ContentView.swift b/vrtnu/vrtnu/ContentView.swift index 67510e2..ca53f08 100644 --- a/vrtnu/vrtnu/ContentView.swift +++ b/vrtnu/vrtnu/ContentView.swift @@ -54,6 +54,7 @@ struct LoginView: View{ struct VRTNuView: View{ var vrtNu: VRTNu var body: some View { + NavigationView(){ List(vrtNu.getShows(), id: \.title){ show in NavigationLink(destination: ShowView(show: show)){ @@ -72,8 +73,8 @@ struct VRTNuView: View{ } } } - } - }.navigationTitle("Browse VRT Nu")//.listStyle(DefaultListStyle()) + }.navigationBarTitle("Browse VRT Nu") + } } } struct ShowView: View { diff --git a/vrtnu/vrtnu/VrtNuLayout.swift b/vrtnu/vrtnu/VrtNuLayout.swift index 86a82d1..4ce3c7b 100644 --- a/vrtnu/vrtnu/VrtNuLayout.swift +++ b/vrtnu/vrtnu/VrtNuLayout.swift @@ -51,7 +51,16 @@ struct Episode: Hashable, Comparable{ let duration = videojson.value(forKey: "duration") as! Double let title = videojson.value(forKey: "title") as! String let targetURLs = videojson.value(forKey: "targetUrls") as! [NSDictionary] - let videourl = targetURLs[0].value(forKey: "url") as! String + var videourl = targetURLs[0].value(forKey: "url") as! String + + // it seams that the hls_aes stream has more changes of playing + // TODO: pass all streams and switch stream if one fails? + for i in 0 ..< targetURLs.count{ + if targetURLs[i].value(forKey: "type") as! String == "hls_aes"{ + videourl = targetURLs[i].value(forKey: "url") as! String + } + } + print(videourl) //session.get('https://media-services-public.vrt.be/vualto-video-aggregator-web/rest/external/v1/videos/%s?vrtPlayerToken=%s&client=%s@PROD' %(video_id, token, clientid)).json() var video = Video(hlsUrl: URL(string: videourl)!,