Skip to content

Commit

Permalink
Merge branch 'release/1.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
Kofktu committed Jan 20, 2022
2 parents a5342ca + 6ee03c2 commit 01ee1ec
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion PIPKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'PIPKit'
s.version = '1.0.4'
s.version = '1.0.5'
s.summary = 'PIP(Picture in Picture) for iOS'

# This description is used to generate tags and improve search results.
Expand Down
4 changes: 2 additions & 2 deletions PIPKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.0.1;
MARKETING_VERSION = 1.0.5;
PRODUCT_BUNDLE_IDENTIFIER = kr.kofktu.PIPKit;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -533,7 +533,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.0.1;
MARKETING_VERSION = 1.0.5;
PRODUCT_BUNDLE_IDENTIFIER = kr.kofktu.PIPKit;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down
10 changes: 7 additions & 3 deletions PIPKit/Classes/AVPIPKit/AVPIPKitRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class AVPIPUIKitRenderer: AVPIPKitRenderer {

let policy: AVPIPKitRenderPolicy
var renderPublisher: AnyPublisher<UIImage, Never> {
render.eraseToAnyPublisher()
_render.eraseToAnyPublisher()
}
var exitPublisher: AnyPublisher<Void, Never> {
_exit.eraseToAnyPublisher()
Expand All @@ -35,7 +35,7 @@ final class AVPIPUIKitRenderer: AVPIPKitRenderer {
private var isRunning: Bool = false
private weak var targetView: UIView?
private var displayLink: CADisplayLink?
private let render = PassthroughSubject<UIImage, Never>()
private let _render = PassthroughSubject<UIImage, Never>()
private let _exit = PassthroughSubject<Void, Never>()

deinit {
Expand Down Expand Up @@ -78,14 +78,18 @@ final class AVPIPUIKitRenderer: AVPIPKitRenderer {
_exit.send(())
}

func render() {
onRender()
}

// MARK: - Private
@objc private func onRender() {
guard let targetView = targetView else {
stop()
return
}

render.send(targetView.uiImage)
_render.send(targetView.uiImage)
}

}
Expand Down
8 changes: 8 additions & 0 deletions PIPKit/Classes/AVPIPKit/AVPIPKitUsable+UIKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public protocol AVPIPUIKitUsable: AVPIPKitUsable {
var renderPolicy: AVPIPKitRenderPolicy { get }
var exitPublisher: AnyPublisher<Void, Never> { get }

// If you want to update the screen, execute the following additional code.
func renderPictureInPicture()

}

@available(iOS 15.0, *)
Expand Down Expand Up @@ -50,6 +53,11 @@ public extension AVPIPUIKitUsable where Self: UIViewController {
videoController?.stop()
}

func renderPictureInPicture() {
setupRendererIfNeeded()
avUIKitRenderer?.render()
}

// MARK: - Private
private func setupRendererIfNeeded() {
guard avUIKitRenderer == nil else {
Expand Down

0 comments on commit 01ee1ec

Please sign in to comment.