{"id":15717483,"url":"https://github.com/insidegui/pipcontainer","last_synced_at":"2025-04-19T12:36:49.739Z","repository":{"id":62450035,"uuid":"77380859","full_name":"insidegui/PIPContainer","owner":"insidegui","description":"An easy to use interface for picture-in-picture on macOS 10.12 and later","archived":false,"fork":false,"pushed_at":"2018-10-01T14:16:04.000Z","size":1987,"stargazers_count":114,"open_issues_count":0,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-25T20:19:50.919Z","etag":null,"topics":["macos","macos-sierra","picture-in-picture","pip","swift"],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/insidegui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-26T11:53:35.000Z","updated_at":"2025-02-02T09:49:37.000Z","dependencies_parsed_at":"2022-11-01T23:18:04.266Z","dependency_job_id":null,"html_url":"https://github.com/insidegui/PIPContainer","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insidegui%2FPIPContainer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insidegui%2FPIPContainer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insidegui%2FPIPContainer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insidegui%2FPIPContainer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/insidegui","download_url":"https://codeload.github.com/insidegui/PIPContainer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246385451,"owners_count":20768668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["macos","macos-sierra","picture-in-picture","pip","swift"],"created_at":"2024-10-03T21:50:17.372Z","updated_at":"2025-03-30T21:31:54.152Z","avatar_url":"https://github.com/insidegui.png","language":"Objective-C","readme":"# PIPContainer\n\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![CocoaPods](https://img.shields.io/cocoapods/v/PIPContainer.svg)]()\n\nAn `NSViewController` subclass that can present its child view controller in picture-in-picture mode.\n\nPlease note that this project links against `PIP.framework`, which is private. Don't try to submit apps using this to the App Store.\n\n![demo](./Screenshots/pipdemo.gif)\n\n# Integration\n\n## Carthage\n\nAdd the following line to your `Cartfile` and follow the [integration instructions for Carthage](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application):\n\n```\ngithub \"insidegui/PIPContainer\" ~\u003e 1.0\n```\n\n## CocoaPods\n\nAdd the following line to your `Podfile` and then run `pod install`:\n\n```\npod 'PIPContainer'\n```\n\n## Manually\n\nDrag `PIPContainer.xcodeproj` to your project and add `PIPContainer.framework` to the `Embedded Binaries` section.\n\n![manual integration](./Screenshots/embedded-binaries.png)\n\n# Usage\n\n## Containment\n\nThe way it works is you add the view controller you want to display in the PiP as a child view controller of `PIPContainerViewController`. This can all be done using storyboards ([see demos](./Demo)).\n\n![storyboard containment](./Screenshots/containment.png)\n\n## Entering and Exiting PiP mode\n\nAfter you have the correct containment setup, simply call `togglePIP` on `PIPContainerViewController` to enter/exit PiP mode.\n\n```swift\nprivate var pip: PIPContainerViewController? {\n    return parent as? PIPContainerViewController\n}\n    \nfunc togglePictureInPictureMode() {\n    pip?.togglePIP(nil)\n}\n```\n\nYou can also link UI controls like buttons and menus directly to the `togglePIP` action in Interface Builder by control-dragging to the First Responder and selecting the action `togglePIP:`.\n\n## Getting notified about PiP commands\n\n`PIPContainerViewController` has many block properties that you can use to get notifications about state changes.\n\n- `pipDidPause`: Called when the pause button is pressed in the PiP panel\n- `pipDidPlay`: Called when the play button is pressed in the PiP panel\n- `pipWillOpen`: Called when the PiP panel is about to be opened. This is the best moment to set the `isPlaying` property of `PIPContainerViewController` to reflect the state of your player\n- `pipWillClose`: Called when the PiP panel is about to be closed\n- `pipDidClose`: Called after the PiP panel is closed and the view controller is back to its original position\n\n## Demos\n\nI encourage you to have a look at the demos to get a better understanding of how PIPContainer works:\n\n- [ObjC demo](./Demo/ObjC)\n- [Swift demo](./Demo/Swift)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsidegui%2Fpipcontainer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finsidegui%2Fpipcontainer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsidegui%2Fpipcontainer/lists"}