added close button

This commit is contained in:
cranci1 2024-12-23 14:55:29 +01:00
parent 5ccbbf1c1b
commit 71d243dba5
5 changed files with 187 additions and 170 deletions

View file

@ -5,6 +5,7 @@
// Created by Pratik on 08/01/23.
//
// Thanks to pratikg29 for this code inside his open source project "https://github.com/pratikg29/Custom-Slider-Control?ref=iosexample.com"
// I did edit just a little bit the code for my liking
//
import SwiftUI

View file

@ -41,6 +41,7 @@ struct CustomMediaPlayer: View {
@State private var duration: Double = 0.0
@State private var showControls = false
@State private var inactivityTimer: Timer?
@Environment(\.presentationMode) var presentationMode
init(urlString: String) {
guard let url = URL(string: urlString) else {
@ -50,6 +51,7 @@ struct CustomMediaPlayer: View {
}
var body: some View {
ZStack {
VStack {
ZStack {
CustomVideoPlayer(player: player)
@ -223,6 +225,23 @@ struct CustomMediaPlayer: View {
}
}
}
VStack {
if showControls {
HStack {
Button(action: {
presentationMode.wrappedValue.dismiss()
}) {
Image(systemName: "xmark")
.foregroundColor(.white)
.font(.system(size: 20))
}
.padding()
Spacer()
}
Spacer()
}
}
}
}
private func startUpdatingCurrentTime() {

View file

@ -35,12 +35,9 @@ struct SettingsView: View {
Text("Minor Interface Settings")
}
NavigationLink(destination: SettingsPlayerView()) {
HStack {
Image(systemName: "play.fill")
Text("Player")
}
}
}
Section(header: Text("External Features")) {
NavigationLink(destination: SettingsModuleView()) {