VLCKit - transparent overlays & layers

macOS specific usage questions
packetship
Blank Cone
Blank Cone
Posts: 17
Joined: 20 Aug 2008 13:21
Location: Cornwall UK
Contact:

VLCKit - transparent overlays & layers

Postby packetship » 11 Apr 2013 12:08

Folks,

Thanks to Felix's build changes I can now build and run VLCKit from 2.1 (unstable) just fine, but I need some more advice please...

I'm trying to overlap a transparent-background WebView on top of the VLCVideoView, but the video always forces itself to the front. Is there any way of making this work with plain ol' views, or do I need to look at VLCVideoLayer? If so is this considered usable, and does anyone have any examples?

Here's my current test code, FWIW, which was mostly pinched from http://kermit.epska.org/2010/how-to-set ... t-in-os-x/

Code: Select all

- (void)awakeFromNib { // Create VLCVideoView inside videoHolderView, taking all of it NSRect rect = NSMakeRect(0, 0, 0, 0); rect.size = [videoHolderView frame].size; videoView = [[VLCVideoView alloc] initWithFrame:rect]; [videoHolderView addSubview:videoView]; [videoView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable]; videoView.fillScreen = YES; // Create player player = [[VLCMediaPlayer alloc] initWithVideoView:videoView]; [player setMedia:[VLCMedia mediaWithURL: [NSURL URLWithString:@"rtsp://barque/testcard"]]]; [player play]; // Load Web page in webView [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString:@"http://barque/gui/main"]]]; }
webView and videoHolderView are simple subviews of the window, semi-overlapping (so I can see the webView actually loads), with webView in front. videoHolderView is a plain NSView.

Many thanks again!

Paul

fkuehne
Developer
Developer
Posts: 7264
Joined: 16 Mar 2004 19:37
VLC version: 0.4.6 - present
Operating System: Darwin
Location: Germany
Contact:

Re: VLCKit - transparent overlays & layers

Postby fkuehne » 11 Apr 2013 15:51

VLCVideoLayer is will disappear soon. I'll deprecate it for 2.1 or even remove it, since it doesn't have a rendering backend for a long time. The old rendering backend was removed during a re-write of VLC's cross-platform video output engine and was never replaced since then.

Regarding your app: why do you use a WebView for this? aaand: wouldn't it be easier to run VLC as a web plugin in your scenario?
VideoLAN
Felix Paul Kühne
Medic. VLC developer for appleOS since before you were born.
Blog: https://www.feepk.net

packetship
Blank Cone
Blank Cone
Posts: 17
Joined: 20 Aug 2008 13:21
Location: Cornwall UK
Contact:

Re: VLCKit - transparent overlays & layers

Postby packetship » 11 Apr 2013 19:10

OK, good job I checked then! Is it possible to get another control (of any sort) overlaid transparently over the video using a VLCVideoView?

The idea of using a WebView is essentially to provide a kind of virtual IPTV set-top box / connected TV environment on a Mac, allowing a single server-based HTML/JS-based UI (with platform-specific CSS and JS tweaks) to work across both Macs and conventional IPTV devices. I did originally think of using the plugin (for Safari) but I got the impression from other posts that there were problems in Mountain Lion - is that not the case any more?

Also there are some other advantages of having a full application to handle full screen, remote controls etc. But even if we went this route the app could just use a WebView with the VLC plugin inside it so the plugin is definitely an option if it works. Just to check, though, does the plugin in fact allow other elements in the zIndex stack to overlay it successfully? (analogous to 'wmode' in the (ahem) Flash player...)

[UPDATE: Found this: ticket 6318 - looks hopeful!]

Many thanks

Paul

packetship
Blank Cone
Blank Cone
Posts: 17
Joined: 20 Aug 2008 13:21
Location: Cornwall UK
Contact:

Re: VLCKit - transparent overlays & layers

Postby packetship » 13 Apr 2013 18:31

Just a quick update: I have found a solution using VLCKit - rather than having the VLCVideoView and WebView in the same window, put the WebView in a transparent child window of the one containing the video. In combination with CoreGraphics full screen mode this works beautifully and because (I think) it is able to use hardware window composition it seems to be pretty efficient as well.

Once again thank you guys for producing such a great universal toolkit!

Paul

fkuehne
Developer
Developer
Posts: 7264
Joined: 16 Mar 2004 19:37
VLC version: 0.4.6 - present
Operating System: Darwin
Location: Germany
Contact:

Re: VLCKit - transparent overlays & layers

Postby fkuehne » 14 Apr 2013 17:29

Heh, this is exactly the solution I wanted to suggest since this is what we do for our fullscreen mode :)
VideoLAN
Felix Paul Kühne
Medic. VLC developer for appleOS since before you were born.
Blog: https://www.feepk.net


Return to “VLC media player for macOS Troubleshooting”

Who is online

Users browsing this forum: No registered users and 24 guests