NSView over VLCVideoView

This forum is about all development around libVLC.
skip
Blank Cone
Blank Cone
Posts: 18
Joined: 16 Jan 2010 03:24

NSView over VLCVideoView

Postby skip » 28 Jan 2010 20:17

I'm using VLCKit to play movies in a cocoa app, that all works fine, but now I've been trying to get a NSView to be displayed on top of the VLCVideoView, a bit like a play/pause controller.

The problem I'm having is that either the overlay view disappears underneath the VLCVideoView (when I add both as subviews to the same parent view), or the overlay will show, but the VLCVideoView stays black (when I make the overlay a subview of VLCVideoView).

Does anyone have any ideas?

Thanks
Skip

skip
Blank Cone
Blank Cone
Posts: 18
Joined: 16 Jan 2010 03:24

Re: NSView over VLCVideoView

Postby skip » 02 Feb 2010 01:24

ok, I've been going over just about every bit of the framework source, but I just don't understand that even if I init the VLCMediaPlayer with a layer (initWithVideoLayer) it still calls

Code: Select all

addVoutSubview:(NSView *)aView


instead of

Code: Select all

addVoutLayer:(CALayer *)voutLayer
I guess once I can get a CALayer with the video, it'll work like any other CALayer but I just can't get to that stage.
Is this a bug or am I just overlooking something??

Thanks
Skip

skip
Blank Cone
Blank Cone
Posts: 18
Joined: 16 Jan 2010 03:24

Re: NSView over VLCVideoView

Postby skip » 02 Feb 2010 23:08

Well, I finally managed to get a NSView (or even a CALayer) to be displayed over the VLCVideoView after many many hours of tinkering.
The weird thing is that the layer initially appears behind the VLCVideoView, but when you make the window as small as possible and then bring it back to the size you want it to be, suddenly the layer appears on top of the VLCVideoView.
I have no idea why, but hey ho it works :-)

Here's the awakeFromNib of the NSView that contains both the VLCVideoView and the overlay, maybe it's of use to someone else...

Code: Select all

- (void)awakeFromNib { videoView = [[VLCVideoView alloc] initWithFrame:NSMakeRect(0,0,self.frame.size.width, self.frame.size.height)]; [self addSubview:videoView]; [videoView release]; player = [[VLCMediaPlayer alloc] initWithVideoView:videoView]; [player setMedia:[VLCMedia mediaWithURL:[NSURL URLWithString:@"udp://@224.99.1.1:1234"]]]; [player play]; NSView *extraView = [[NSView alloc] initWithFrame:NSMakeRect(100,200,self.frame.size.width/5, self.frame.size.height/5)]; [self addSubview:extraView]; [extraView setWantsLayer:YES]; [extraView.layer setBackgroundColor:CGColorCreateGenericRGB(1.0, 0.0, 0.0, 0.5)]; }

soulless
New Cone
New Cone
Posts: 3
Joined: 08 Dec 2010 02:30

Re: NSView over VLCVideoView

Postby soulless » 08 Dec 2010 02:37

Hi, I found the same error with subviews when I try add subview to VLCVideoView.

I need a solution programatically. I can't say to my users: "if you make the window as small as possible and then bring it back to the size you want it to be my application run ok" :-D.

Skip o other user found a solution in the code. Excuse my horrible english and thank you.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 2 guests