My app plays videos. At first I used SwiftUI’s VideoPlayer
, but that didn't give me enough control over the underlying AVPlayerView
, so I created my own NSViewRepresentable
. That works well, and I can adjust the AVPlayerView
as I see fit.
But it seems to have a contextual menu that still appears instead of the one I try to apply using SwiftUI. If I put a non-opaque color over the AVPlayerView
in a ZStack
, I'm able to then add a .contextMenu
that works, but only if the color is non-opaque (e.g. Color(red: 0, green: 0, blue: 0, opacity: 0.00001)
). This feels like a pretty hacky solution, and doesn’t work if I set opacity:
to 0.
Is there a better way to keep AVPlayerView
from handling events? It also gets scroll events (which scrubs through the movie) that I'd like to suppress.