0

I am working on a Cocoa Project . In my project I am dragging a media to my window and trying

to view / play it using QLPreviewController.I got a requirement where I should play & pause my

video when I click the space bar (after viewing it in QLPreviewController).My

QLPreviewView is added as subview to NSWindow and this window is shown as follows.

[mediaWindow addSubView:previewWindow];//previewWindow is QLPreviewView instance

[mediaWindow ShowWindow:nil]; //mediaWindow is NSWindow

I wanted know how to enable play and pause through the space bar when the video is viewed ,

which is not happening currently . Any help is appreciated.

Quxflux
  • 3,133
  • 2
  • 26
  • 46
Keerthiraj
  • 265
  • 2
  • 4
  • 10

1 Answers1

0

I don't know the implementation of qlpreviewcontroller but you should actually just get the key event and then react by doing something with the aforementioned view controller. Key events can be received by overriding following methods (as stated in this question):

-(void)keyDown:(NSEvent*)theEvent
{
    NSString* keysPressed = [theEvent characters];
    if ( [keysPressed isEqualToString:@" "] )
    {

    }
}
Community
  • 1
  • 1
Quxflux
  • 3,133
  • 2
  • 26
  • 46