Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
CaiWanFeng committed Apr 16, 2023
1 parent 2b869e0 commit 4823411
Showing 1 changed file with 32 additions and 12 deletions.
44 changes: 32 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,37 @@
[中文文档](README_cn.md)

# [中文文档](README_cn.md)

# Features:

1. You can add any custom view on the pip window;
2. You can hide speed button, backward button, play button and progress bar on the pip window;
3. You can modify the pip window’s shape dynamically with code;
4. You can rotate the pip window with code;
5. You can take photos and record a video while using pip;
6. The screen would not turn dark when you take photos or record videos;
7. Timer would never stop while taking photos or recording videos;
8. The timer's accuracy is millisecond;
9. The solution for your app rejected by Apple.
### 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:
Expand All @@ -27,6 +47,6 @@
# Contact:
For more technical exchange you can add my WeChat: *cq1351675135* or scan:
For more technical exchange you can scan to add my WeChat:
![contact](contact.PNG)

0 comments on commit 4823411

Please sign in to comment.