Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/CaiWanFeng/PiP
The best way to customize picture-in-picture for iOS.
https://github.com/CaiWanFeng/PiP
avpictureinpictureviewcontroller custom-pip float-timer floatwindow ios objective-c picture-in-picture pictureinpicutre pip pip-mode swift teleprompter
Last synced: about 1 month ago
JSON representation
The best way to customize picture-in-picture for iOS.
- Host: GitHub
- URL: https://github.com/CaiWanFeng/PiP
- Owner: CaiWanFeng
- Created: 2021-11-10T09:44:16.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-29T03:36:36.000Z (about 2 months ago)
- Last Synced: 2024-10-29T04:28:22.470Z (about 2 months ago)
- Topics: avpictureinpictureviewcontroller, custom-pip, float-timer, floatwindow, ios, objective-c, picture-in-picture, pictureinpicutre, pip, pip-mode, swift, teleprompter
- Language: Swift
- Homepage:
- Size: 11.7 MB
- Stars: 241
- Watchers: 6
- Forks: 62
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# [中文文档](README_cn.md)
# Features:
### 1. You can add any custom view on the pip window.
```swift
func pictureInPictureControllerWillStartPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) {
// note this is first window
if let window = UIApplication.shared.windows.first {
window.addSubview(customView)
// use autoLayout
customView.snp.makeConstraints { (make) -> Void in
make.edges.equalToSuperview()
}
}
}
```### 2. You can hide speed button, backward button, play button and progress bar on the pip window.
https://stackoverflow.com/questions/67528832/how-to-hide-system-controls-on-avpictureinpicturecontrollers-float-window#67528832### 3. You can modify the pip window’s shape dynamically with code.
**The shape of the pip window depends on the shape of video**. So just change current video to a video with a different shape.
Sample code like:
```objective-c
NSURL *url = [[NSBundle mainBundle] URLForResource:videoName withExtension:@"MP4"];
AVAsset *asset = [AVAsset assetWithURL:url];
AVPlayerItem * item = [[AVPlayerItem alloc] initWithAsset:asset];
[self.pipController.playerLayer.player replaceCurrentItemWithPlayerItem:item];
```# Demos:
## 1. float_teleprompter
![float_teleprompter](float_teleprompter.GIF)
## 2. float_timer
![float_timer](float_timer.PNG)
# Contact:
For more technical exchange you can scan to add my WeChat:
![contact](contact.PNG)