Skip to content

Commit

Permalink
Smooth transition for VideoView capture position update (#383)
Browse files Browse the repository at this point in the history
When capture position update is detected:
1. Creates a secondary renderer view in the back of primary renderer
2. Renders some frames (2 frames) on secondary renderer
3. Executes animated primary secondary renderer swap
4. Sets rendering back to primary renderer

- [x] Ensure clean up
- [x] Add animation preference properties

<table>
    <thead>
        <tr>
            <th align="center">Before this PR</th>
            <th align="center">CrossDissolve</th>
            <th align="center">Flip</th>
        </tr>
    </thead>
    <tbody>
        <tr>
<td align="left"><video
src="https://github.com/livekit/client-sdk-swift/assets/548776/fc2a95c1-c77a-4e67-a798-97e77867f8d7"
controls="controls" style="max-width: 730px;"></video></td>
<td align="center"><video
src="https://github.com/livekit/client-sdk-swift/assets/548776/4c025cbe-028c-46f3-9154-8349e3c35224"
controls="controls" style="max-width: 730px;"></video></td>
<td align="right"><video
src="https://github.com/livekit/client-sdk-swift/assets/548776/20914b2e-ffa2-4420-8307-2a33b61d463f"
controls="controls" style="max-width: 730px;"></video></td>
        </tr>
    </tbody>
</table>
  • Loading branch information
hiroshihorie authored May 27, 2024
1 parent 60cb24c commit 7dd9a43
Show file tree
Hide file tree
Showing 2 changed files with 196 additions and 50 deletions.
4 changes: 4 additions & 0 deletions Sources/LiveKit/Support/NativeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ open class NativeView: NativeViewType {
public func bringSubviewToFront(_ view: NSView) {
addSubview(view)
}

public func insertSubview(_ view: NSView, belowSubview: NSView) {
addSubview(view, positioned: .below, relativeTo: belowSubview)
}
#endif

open func performLayout() {
Expand Down
Loading

0 comments on commit 7dd9a43

Please sign in to comment.