fix: VideoPlayerView nested type accessing enclosing schema — pass controlsStyle as param
This commit is contained in:
parent
1375f2d2e6
commit
7ffb8d3f78
@ -50,17 +50,19 @@ struct VideoPlayerControl: View {
|
|||||||
|
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
private var macOSPlayerView: some View {
|
private var macOSPlayerView: some View {
|
||||||
VideoPlayerView(player: player)
|
let style: AVPlayerViewControlsStyle = schema.options.controls == false ? .none : .default
|
||||||
|
return VideoPlayerView(player: player, controlsStyle: style)
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
}
|
}
|
||||||
|
|
||||||
private struct VideoPlayerView: NSViewRepresentable {
|
private struct VideoPlayerView: NSViewRepresentable {
|
||||||
let player: AVPlayer?
|
let player: AVPlayer?
|
||||||
|
let controlsStyle: AVPlayerViewControlsStyle
|
||||||
|
|
||||||
func makeNSView(context: Context) -> NSView {
|
func makeNSView(context: Context) -> NSView {
|
||||||
let view = AVPlayerView()
|
let view = AVPlayerView()
|
||||||
view.player = player
|
view.player = player
|
||||||
view.controlsStyle = schema.options.controls == false ? .none : .default
|
view.controlsStyle = controlsStyle
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user