I'm very new to X Code.. but I'm having trouble figuring out why the "play" button is not showing up on the screen (over the top of a background image) after a successful build of the app in ContentView. Ultimately, I'd like to position the button to a specific area on the screen and have the button launch a video that is hosted on Cloudflare. But, at the moment, I cannot seem to get the button to show up on screen. I get the background to show up after a successful build.. but nothing else. I've tried to use storyboard to drag and drop a button but even that fails to show up. I'm so new to this that I'm getting easily stalled.
//
// ContentView.swift
//
//
//
//
import SwiftUI
import CoreData
import UIKit
import AVKit
import TVUIKit
struct
contentview: View {
var body: some View {
ZStack {
Button(action: {
// What the button does
}) {
// How the button looks like
Text("PLAY")
.font(.headline)
.fontWeight(.semibold)
.foregroundColor(Color.white)
.padding(10)
.frame(minWidth: 100)
.background(
RoundedRectangle(cornerRadius: 10)
.fill(Color.gray)
)
}.buttonStyle(.plain) // Prevents the automatic style
Image("SedonaNowCenterBGwtxt") .resizable()
.aspectRatio(contentMode: .fill)
}
}
struct SwiftUIView_Previews: PreviewProvider {
static var previews: some View {
contentview()
.previewInterfaceOrientation(.landscapeLeft)
.previewLayout(.sizeThatFits)
.previewDevice("Apple TV 4K (3rd generation) (at 1080p)")
}
}
}
struct Previews_SwiftUIView_Previews: PreviewProvider {
static var previews: some View {
ZStack {
Image("SedonaNowCenterBGwtxt") .resizable()
.aspectRatio(contentMode: .fill)
}
}
}
//import AVKit
//import TVUIKit
extension AVPlayerViewController {
// Configure 16:9 UICollectionView cell
struct myView: View {
// Change the url to the Cloudflare Stream HLS manifest URL
private let player = AVPlayer(url: URL(string: )!)
var body: some View {
VideoPlayer(player: player)
.onAppear() {
player.play()
}
}
}
struct myView_Previews: PreviewProvider {
static var previews: some View {
myView()
}
}
}