VLC like control panel in Cocoa - cocoa

I'm writting a video player application (using AVFoundation) for MacOS X and I would like to have the same kind of control panel than VLC (fading out after a few second).
What is the best option to implement this?
I'm thinking about a custom NSWindowControl object that I could design separately with the interface builder but I don't understand very well how to sequence the creation and display step, but I was wondering if there was a best option subclassing a NSViewController...

I simply add a NSPanel in the interface builder, add it as a child window from my main window and add a notification when the main window resize to resize the panel accordingly.

Related

How to create whole screen overlay in MacOS with Swift?

There's an app called Intermission that creates a whole screen overlay:
I tried creating a floating panel which utilizes NSPanel (adapted from https://cindori.com/developer/floating-panel), but it is unable to expand beyond the toolbar/app bar.
I know I can create a new window in full screen mode and achieve a similar result, however I want to draw this overlay directly on top of the screen without entering full screen mode. How can I achieve this result in the way the Intermission app does it?
I figured it out! The trick is to set NSWindow.Level to .popUpMenu. This allows it to appear above the menubar and dock.

How to create a global overlay for MacOS?

I am trying to develop a MacOS application using Xcode and Cocoa. My intent is to create an overlay on the user's screen that is mostly transparent, and does not register input. For example, an application like f.lux tints the colour of your entire screen like a global overlay, but you can still click on-screen items, as mouse clicks go right through (assuming that it's an overlay). How can I get started with achieving a similar overlay/widget?

Call indicator bar is not responding for audio and video call

I have implemented Twilio voice kit successfully in the application.
I am not able to move in the application from call indicator. Also, I am not able to see green bar on other application screen when user moves from call screen. I have added custom view in navigation bar, but it's not much responsive.
I have following doubts for the same.
Is there any default property which I need to enable to display
native call indicator in the application?
Do I need to put a custom
view as I have done? If yes then what will be the best approach to do
it?
Is there any alternative to display custom call indicator inside
the application rather than adding view in navigation bar?
Any help will be appreciated.
Thank you.
As far as I know, CallKit framework does not have any API for you to use to display their native UI regarding the calls. The green indicator bar is shown if you have an active VoIP call and your app is running in background.
By tapping on it it will just open your VoIP app.
The best approach is to use a custom-built UIView, placed on a separate UIWindow that has the same level as the system's status bar and add a tap gesture on it to achieve what the native green bar is doing. Also, you can even add the animation that fades in and out a label to create the same experience as the native green bar.

Embedding quicktime player in Cocoa app

I'm wondering if it's possible for me to embed the quicktime player in a cocoa app. The default QTMovieView is kind of ugly, and the quicktime player window has all the features I need in it, such as full screen, and the maintain aspect ratio button.
I'd like it to operate transparently to the user though. I'd rather avoid making them launch the quicktime app. I'd also like to be able to position the window on the screen. Also, I need to be able to access the current playhead position, and capture when they stop the movie. Any ideas on how I might go about doing this? Or would I have to build out my own custom video player?
A third party component would be fine as well if any exist. I'm just looking for that same quicktime player appearance with the black control bar that appears when hovering over the screen.
Or would I have to build out my own custom video player?
Yes. There is no (reliable) way of getting QuickTime player to integrate into your application.
You should make a subclass of QTMovieView, and maybe use some subviews for the controls.
You can hide the controls if the QTMovieView if you do not like them. In IB switch off Show Controller property.
Alternatively, you can use QTMovieLayer.
Also, it is easy to create your own set of controls that will work directly with the properties and methods of the QTMovie.

Cocoa Single View question

Is there a way to have a single full-screen picture load when the cocoa app is launched? What I mean by that is a full-screen picture, without the menus and stuff that cocoa automatically attaches to apps.( For example, I want to build an app that when the user clicks it - it brings up a picture of say, a zombie, completely full screen - kind of like the end of that maze game.)
While I'm not aware of any maze games that feature a zombie at the end (though I imagine it would be a great companion to Plants vs. Zombies), you can achieve your goal by using NSView's built-in full-screen method -enterFullScreenMode:withOptions: and exit with -exitFullScreenModeWithOptions:.
To enter full screen at launch, just use the NSApplicationDelegate method -applicationDidFinishLaunching:.
As for UI arrangement, I'd just open MainMenu.xib in Interface Builder and delete the window, then drag an NSView ("Custom View") or just a NSImageView into the IB document and open it up. Create an outlet to the view in your app delegate / app controller and connect it to the view.

Resources