• Stars
    star
    202
  • Rank 192,572 (Top 4 %)
  • Language
    Swift
  • License
    MIT License
  • Created almost 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This library is a UIView that is capable of Picture-in-Picture (PiP) in iOS.

>> 日本語

UIPiPView

This library is a UIView that is capable of Picture-in-Picture (PiP) in iOS.

Using this library, information that is updated in real time (e.g. stock prices) can be displayed on the screen using PiP, even when the app is in the background. We look forward to seeing many ideas come to fruition using this library.

Requirements

You need to be running iOS15 or higher. This library can be installed on iOS12 or higher, but PiP cannot be executed without iOS15 or higher.

Also, as a note for development, PiP will only work on ACTUAL DEVICES. Please note that PiP does not work with simulators. Also, this library depends on AVKit and AVFoundation.

If you want to include this library in your app, you need to enable Audio, AirPlay and Picture in Picture in Background Modes. For more information, see Apple's page.

Installation

UIPiPView can be installed using CocoaPods. You can install it using You can install it by writing the following to your Podfile and running $ pod install.

pod 'UIPiPView', :git => 'https://github.com/uakihir0/UIPiPView/', :branch => 'main'

or can be installed using SwiftPM.

Example

It is always a good idea to check if your environment is ready to use UIPiPView before you start. You can do this with the following code.

uiPipView.isUIPiPViewSupported()

Start

Since UIPiPView inherits from UIView, it can be used in the same way as UIView. To run PiP, execute the following function. Run the following function to run PiP.

uiPipView.startPictureInPicture(withRefreshInterval: (0.1 / 60.0))

The above function will refresh the PiP screen 60 times per second. The screen refresh is a relatively heavy process because the UIView is converted to a CMSampleBuffer via a UIImage. Therefore, if the UIView is complex, the update processing may not be able to keep up, or it may affect other processing. In that case, change the arguments in the above code to reduce the update frequency, or run PiP with the following code.

uiPipView.startPictureInPictureWithManualCallRender()

The above function will not automatically refresh the screen except for the first screen refresh. If you want to update the screen, execute the following additional code.

uiPipView.render()

Running the above function will render the state of the UIPiPView at the time the thread completes. By using this function, we can perform rendering at each screen update timing and keep the rendering cost to a minimum.

Exit

To exit PiP, execute the following code.

uiPipView.stopPictureInPicture()

Author

Akihiro Urushihara
Mail: [email protected]
Twitter: @uakihir0

License

UIPiPiPView is available under the MIT license. See the LICENSE file for more info.

More Repositories

1

UIPiPDemo

Demo App for Picture-in-Picture of Arbitrary UIView in iOS
Swift
79
star
2

SocialHub

SocialHub is multi social media (SNS) client for Java and Objective-C (with J2ObjC)
Java
52
star
3

misskey4j

misskey client written in java.
Java
29
star
4

bsky4j

Bluesky/ATProtocol client for java
Java
25
star
5

twitter-web-client

Twitter Client Library calling WEB API.
Java
13
star
6

kbsky

Kotlin multiplatform Bluesky/ATProtocol library.
Kotlin
13
star
7

nostr-rest

Nostr rest api wrapper server.
Go
9
star
8

jtw

Twitter V2 API client library for Java.
Java
7
star
9

mildom-gift-viewer

Mildom 向けギフトを降らすツール
JavaScript
7
star
10

kmisskey

Kotlin multiplatform Misskey library.
Kotlin
4
star
11

fecipher

TCG FE Cipher game logic.
Python
3
star
12

mildom-user-list

JavaScript
3
star
13

kbsky-cocoapods

Bluesky/ATProtoco library for Apple Devices with Cocoapods.
Objective-C
3
star
14

SocialHub-WebPage

SocialHub WebPage Project.
HTML
2
star
15

gallery-data

2
star
16

gallery-web

TypeScript
2
star
17

blog

Urushi's Blog
SCSS
1
star
18

conductor-kotlin-dsl

Netflix Conductor Kotlin DSL (build json with Kotlin DSL)
Kotlin
1
star
19

onlytabcast

When a tab is ChoromeCast on a site such as Youtube or Twitch, the tab itself will be cast instead of being played in the app.
1
star
20

yahooapik

Yahoo API Client written by Kotlin.
Kotlin
1
star
21

zenn

Zenn (https://zenn.dev/) articles.
1
star
22

uakihir0.github.io

Portfolio
HTML
1
star
23

kmisskey-cocoapods

Objective-C
1
star
24

ktumblr

Kotlin multiplatform Tumblr library.
Kotlin
1
star
25

kmisskey.js

JavaScript
1
star
26

kmastodon

Kotlin multiplatform Mastodon library.
Kotlin
1
star
27

planetlink

Kotlin multiplatform Multi Social Media library.
Kotlin
1
star
28

khttpclient

Kotlin multiplatform simple http request library.
Kotlin
1
star
29

planetlink-cocoapods

Objective-C
1
star