added stub shows, seasons and episodes, started work on a navigation view
This commit is contained in:
parent
8bf0c603b0
commit
a14d16b91d
|
@ -14,6 +14,7 @@
|
|||
B4F0CC8D251BE62F00E9EA74 /* vrtnuTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4F0CC8C251BE62F00E9EA74 /* vrtnuTests.swift */; };
|
||||
B4F0CC98251BE62F00E9EA74 /* vrtnuUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4F0CC97251BE62F00E9EA74 /* vrtnuUITests.swift */; };
|
||||
B4F0CCAA251BFD6F00E9EA74 /* video.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4F0CCA9251BFD6F00E9EA74 /* video.swift */; };
|
||||
B4F0CCB7251D6B5400E9EA74 /* VrtNuLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4F0CCB6251D6B5400E9EA74 /* VrtNuLayout.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
|
@ -47,6 +48,7 @@
|
|||
B4F0CC97251BE62F00E9EA74 /* vrtnuUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = vrtnuUITests.swift; sourceTree = "<group>"; };
|
||||
B4F0CC99251BE62F00E9EA74 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
B4F0CCA9251BFD6F00E9EA74 /* video.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = video.swift; sourceTree = "<group>"; };
|
||||
B4F0CCB6251D6B5400E9EA74 /* VrtNuLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VrtNuLayout.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -103,6 +105,7 @@
|
|||
B4F0CC83251BE62F00E9EA74 /* Info.plist */,
|
||||
B4F0CC80251BE62F00E9EA74 /* Preview Content */,
|
||||
B4F0CCA9251BFD6F00E9EA74 /* video.swift */,
|
||||
B4F0CCB6251D6B5400E9EA74 /* VrtNuLayout.swift */,
|
||||
);
|
||||
path = vrtnu;
|
||||
sourceTree = "<group>";
|
||||
|
@ -263,6 +266,7 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B4F0CC7D251BE62B00E9EA74 /* ContentView.swift in Sources */,
|
||||
B4F0CCB7251D6B5400E9EA74 /* VrtNuLayout.swift in Sources */,
|
||||
B4F0CC7B251BE62B00E9EA74 /* vrtnuApp.swift in Sources */,
|
||||
B4F0CCAA251BFD6F00E9EA74 /* video.swift in Sources */,
|
||||
);
|
||||
|
|
|
@ -10,15 +10,45 @@ import AVKit
|
|||
import AVFoundation
|
||||
|
||||
struct ContentView: View {
|
||||
private let player = AVPlayer(url: URL(string: "https://remix-cf.lwc.vrtcdn.be/remix/ecd69313-4a39-4297-95b1-aede167725b7/remix.ism/.m3u8")!)
|
||||
|
||||
var body: some View {
|
||||
VideoPlayer(player: player)
|
||||
};
|
||||
|
||||
NavigationView{
|
||||
List {
|
||||
ForEach(VRTNu().shows, id: \.self){ show in
|
||||
Section(header: Text(show.title)){
|
||||
HStack{
|
||||
ForEach(show.seasons, id:\.self){ season in
|
||||
HStack{
|
||||
ForEach(season.episodes, id:\.self){ episode in
|
||||
Text(season.seasonName)
|
||||
Text(episode.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("VRT Nu")
|
||||
.listStyle(GroupedListStyle())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*struct SeasonView: View{
|
||||
var body: some View{
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
struct VideoView: View {
|
||||
private let player = AVPlayer(url: URL(string: "https://remix-cf.lwc.vrtcdn.be/remix/ecd69313-4a39-4297-95b1-aede167725b7/remix.ism/.m3u8")!);
|
||||
|
||||
var body: some View {
|
||||
VideoPlayer(player: player).fixedSize()
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ContentView()
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
//
|
||||
// VrtNuLayout.swift
|
||||
// vrtnu
|
||||
//
|
||||
// Created by Jens Timmerman on 25/09/2020.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct Episode: Hashable{
|
||||
let name: String
|
||||
let video: Video
|
||||
let imageurl: URL
|
||||
|
||||
init(episodeurl: URL){
|
||||
self.name = "test"
|
||||
self.video = Video(hlsUrl: URL(string: "https://remix-cf.lwc.vrtcdn.be/remix/ecd69313-4a39-4297-95b1-aede167725b7/remix.ism/.m3u8")!,
|
||||
title: "best of dinges",
|
||||
duration: 2946)
|
||||
self.imageurl = URL(string: "https://images.vrt.be/w320hx/2019/05/02/dbc03914-6cbc-11e9-abcc-02b7b76bf47f.jpg")!
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct Season: Hashable{
|
||||
static func == (lhs: Season, rhs: Season) -> Bool {
|
||||
return lhs.seasonUrl == rhs.seasonUrl
|
||||
}
|
||||
|
||||
|
||||
let seasonName: String
|
||||
let seasonUrl: URL
|
||||
let episodes: [Episode]
|
||||
|
||||
init(seasonUrl: URL){
|
||||
self.seasonUrl = seasonUrl
|
||||
self.episodes = [
|
||||
Episode(episodeurl: URL(string: "https://www.vrt.be/vrtnu/a-z/het-peulengaleis/2005-hm/het-peulengaleis-s2005-hma1/")!)
|
||||
]
|
||||
self.seasonName = "Best of"
|
||||
}
|
||||
}
|
||||
|
||||
struct Show: Hashable{
|
||||
static func == (lhs: Show, rhs: Show) -> Bool {
|
||||
return lhs.showUrl == rhs.showUrl
|
||||
}
|
||||
|
||||
|
||||
let showUrl: URL
|
||||
let title: String
|
||||
let seasons: [Season]
|
||||
let imageUrl: URL
|
||||
|
||||
init(showUrl: URL, title: String) {
|
||||
self.showUrl = showUrl
|
||||
self.title = title
|
||||
self.imageUrl = URL(string: "https://images.vrt.be/w320hx/2019/05/02/dbc03914-6cbc-11e9-abcc-02b7b76bf47f.jpg")!
|
||||
//TODO: fetch seasons
|
||||
self.seasons = [
|
||||
Season(seasonUrl: URL(string: "https://www.vrt.be/vrtnu/a-z/het-peulengaleis/2005-hm/")!),
|
||||
Season(seasonUrl: URL(string: "https://www.vrt.be/vrtnu/a-z/het-peulengaleis/3/")!),
|
||||
Season(seasonUrl: URL(string: "https://www.vrt.be/vrtnu/a-z/het-peulengaleis/4/")!),
|
||||
Season(seasonUrl: URL(string: "https://www.vrt.be/vrtnu/a-z/het-peulengaleis/5/")!)
|
||||
]
|
||||
}
|
||||
|
||||
func getimageurl() -> URL{
|
||||
//TODO: stub
|
||||
return self.imageUrl
|
||||
}
|
||||
}
|
||||
|
||||
struct VRTNu {
|
||||
let shows: [Show]
|
||||
|
||||
init() {
|
||||
//TODO: fetch shows
|
||||
self.shows = [Show(showUrl: URL(string: "https://www.vrt.be/vrtnu/a-z/het-peulengaleis/")!, title: "Het Peulengaleis")]
|
||||
}
|
||||
}
|
|
@ -37,7 +37,10 @@ extension Video {
|
|||
Video(hlsUrl: URL(string: "https://remix-cf.lwc.vrtcdn.be/remix/ecd69313-4a39-4297-95b1-aede167725b7/remix.ism/.m3u8")!,
|
||||
title: "best of dinges",
|
||||
duration: 2946),
|
||||
|
||||
Video(hlsUrl: URL(string: "https://remix-cf.lwc.vrtcdn.be/remix/ecd69313-4a39-4297-95b1-aede167725b7/remix.ism/.m3u8")!,
|
||||
title: "best of dinges 2",
|
||||
duration: 2946),
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue