vrtnu-app/vrtnu/vrtnu/ContentView.swift

69 lines
1.9 KiB
Swift

//
// ContentView.swift
// vrtnu
//
// Created by Jens Timmerman on 23/09/2020.
//
import SwiftUI
import AVKit
import AVFoundation
import Combine
struct ContentView: View {
var body: some View {
NavigationView{
VStack {
ForEach(VRTNu().shows, id: \.self){ show in
VStack{
Text(show.title)
HStack{
ForEach(show.seasons, id:\.self){ season in
ForEach(season.episodes, id:\.self){ episode in
NavigationLink(destination: VideoView(url: episode.video.hlsUrl)){VStack{
Text(season.seasonName)
Text(episode.name)
AsyncImage(
url: episode.imageurl,
placeholder: { Text("Loading ...") },
image: { Image(uiImage: $0).resizable() }
)
}}
}
}
}
}
}
}
.navigationTitle("VRT Nu")
.listStyle(GroupedListStyle())
}
}
}
/*struct SeasonView: View{
var body: some View{
}
URL(string: "https://remix-cf.lwc.vrtcdn.be/remix/ecd69313-4a39-4297-95b1-aede167725b7/remix.ism/.m3u8")!
}*/
struct VideoView: View {
var url: URL
var body: some View {
let player = AVPlayer(url: url);
VideoPlayer(player: player).fixedSize()
};
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}