Im using more easily to create a pick up and play a video, and that part works, and to show the video I use this line:
PhotoPickerResultView(result: photoPickerService.results[0])
and this part work fine to, arrives from this:
struct PhotoPickerResultView: View {
var result: PHPickerResult
enum MediaType {
case loading, error, video
}
@State private var loaded = false
@State private var url: URL?
@State private var mediaType: MediaType = .loading
@State private var latestErrorDescription = ""
var body: some View {
Group {
switch mediaType {
case .loading:
ProgressView()
case .error:
VStack {
Image(systemName: "exclamationmark.triangle.fill")
Text(latestErrorDescription).font(.caption)
}
.foregroundColor(.gray)
case .video:
if url != nil {
VideoPlayer(player: AVPlayer(url: url!))
...
.....
My question is, How can I use or implement the custom buttons of the AVPlayer? like:
@State private var player1 = AVPlayer(url: URL(string: "https...mp4")!)
VideoPlayer(player: player1)
Button {
player1.play()
} label: {
Text(" PLAY ")
}
Button {
player1.pause()
} label: {
Text(" PAUSE ")
}
from this line:
PhotoPickerResultView(result: photoPickerService.results[0])
???
or what do I have to change to use more easily that custom buttons of the AVPlayer??
Thanks