How to Disable Mouse Wheel Event in AVPlayerView?

591 Views Asked by At

While AVPlayerView Watching, Sliding Mouse Wheel makes pause movie then fast forward or rewind. this makes process error.

I set AVPlayerView Mode as NONE, btw.

let me know how to disable mouse wheel event on AVPlayerView.

2

There are 2 best solutions below

0
On

Override hitTest:

@interface MyAVPlayerView : AVPlayerView
@end

@implementation MyAVPlayerView

- (NSView *)hitTest:(NSPoint)aPoint
{
   if (prohibitScrolling) {
      return nil;
   } else {
      return [super hitTest:aPoint];
   }
}

@end
2
On

Swift 3 (forwards scrolling to the view underneath it):

class NonScrollableAVPlayerView : AVPlayerView
{
    override func scrollWheel(with event: NSEvent)
    {
        if self.superview != nil
        {
            self.nextResponder?.scrollWheel(with: event)
        }
    }
}