Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 37dc3dc

Browse files
update
1 parent e32b8d6 commit 37dc3dc

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

‎Sources/swiftui-loop-videoplayer/utils/VideoSettings.swift‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,7 @@ public struct VideoSettings: Equatable{
117117

118118
@available(iOS 14.0, macOS 11.0, tvOS 14.0, *)
119119
public extension VideoSettings {
120-
121-
func getAssets()-> AVURLAsset?{
122-
assetFor(self)
123-
}
124-
120+
125121
/// Checks if the asset has changed based on the provided settings and current asset.
126122
/// - Parameters:
127123
/// - asset: The current asset being played.

‎Sources/swiftui-loop-videoplayer/view/helpers/PlayerCoordinator.swift‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,27 @@ internal class PlayerCoordinator: NSObject, PlayerDelegateProtocol {
144144
#if os(iOS)
145145
extension PlayerCoordinator: AVPictureInPictureControllerDelegate{
146146

147+
/// Called when Picture-in-Picture (PiP) mode starts.
148+
///
149+
/// - Parameter pictureInPictureController: The `AVPictureInPictureController` instance managing the PiP session.
150+
///
151+
/// This method is marked as `nonisolated` to avoid being tied to the actor's execution context,
152+
/// allowing it to be called from any thread. It publishes a `.startedPiP` event on the `eventPublisher`
153+
/// within a `Task` running on the `MainActor`, ensuring UI updates are handled on the main thread.
147154
nonisolated func pictureInPictureControllerDidStartPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) {
148155
Task{ @MainActor in
149156
eventPublisher.send(.startedPiP)
150157
}
151158
}
152159

160+
161+
/// Called when Picture-in-Picture (PiP) mode stops.
162+
///
163+
/// - Parameter pictureInPictureController: The `AVPictureInPictureController` instance managing the PiP session.
164+
///
165+
/// Like its counterpart for starting PiP, this method is `nonisolated`, allowing it to be executed from any thread.
166+
/// It sends a `.stoppedPiP` event via `eventPublisher` on the `MainActor`, ensuring any UI-related handling
167+
/// occurs safely on the main thread.
153168
nonisolated func pictureInPictureControllerDidStopPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) {
154169
Task{ @MainActor in
155170
eventPublisher.send(.stoppedPiP)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /