Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS screen share audio #576

Open
wants to merge 59 commits into
base: main
Choose a base branch
from
Open

iOS screen share audio #576

wants to merge 59 commits into from

Conversation

ladvoc
Copy link
Contributor

@ladvoc ladvoc commented Feb 5, 2025

This PR adds support for capturing application audio during screen share when using a broadcast extension.

Note: PR #598 should be merged first.

ladvoc added 30 commits January 24, 2025 09:21
- Rename `SocketConnectionFrameReader` to `SocketConnectionSampleReader`.
- Utilize the new `HTTPMessageReader` and `BroadcastSampleDecoder` types.
- Replaces the functionality of the existing `Message` class.
- `didCapture` now emits a `BroadcastSample`.
- General refactoring for enhanced readability.
- Uses the Network framework
- Enables bi-directional communication and dynamic message headers
- Create `BroadcastUploader` and `BroadcastReceiver` utilizing `IPCChannel`
- Separates concerns of socket communication, message format, and sample encoding/decoding
- Integrate into existing code
- Remove old components
Ensure proper handling of channel closure initiated either by the capture ending or the broadcast ending.
- Fix socket tests for iOS by using relative paths
- Replace `@Atomic` with `StateSync` in preparation for adding audio support.
- Make `upload(_:with:)` non-async; ReplayKit docs state references to the sample buffer should not be kept after `processSampleBuffer(_:type:)` returns.
@ladvoc ladvoc mentioned this pull request Feb 6, 2025
@ladvoc ladvoc mentioned this pull request Feb 7, 2025
hiroshihorie added a commit that referenced this pull request Feb 13, 2025
- Add version and platform compatibility badges from [Swift Package
Index](https://swiftpackageindex.com/) to README
  - Automatically updated on each release 
- Add [nanpa](https://github.com/nbsp/nanpa) configuration
- Custom script bumps version across repo (currently Podspec, README,
and LiveKitSDK class)
  - GitHub publish workflow (based on workflow from livekit/rust-sdks)
- Create workflow to push new releases to Cocopods when a release is
published on GitHub

I have also added changeset files to my currently open PRs (#565, #576,
and #573) that can be used to test this configuration.

---------

Co-authored-by: Hiroshi Horie <[email protected]>
hiroshihorie added a commit to ladvoc/client-sdk-swift that referenced this pull request Feb 13, 2025
commit aa0a21d
Author: Jacob Gelman <[email protected]>
Date:   Thu Feb 13 06:28:21 2025 -0800

    Simplify broadcast extension setup with standard format for identifiers (livekit#573)

    When configuring a broadcast extension, manually setting the info keys
    `RTCAppGroupIdentifier` and `RTCScreenSharingExtension` is no longer
    required when using the standard format. The standard format is as
    follows:
    - App group: `group.<main-app-bundle-id>`
    - Broadcast extension: `<main-app-bundle-id>.broadcast`

    ---------

    Co-authored-by: Hiroshi Horie <[email protected]>

commit c3ee701
Author: Jacob Gelman <[email protected]>
Date:   Thu Feb 13 06:05:00 2025 -0800

    Deprecate public broadcast picker extension (livekit#586)

    Public show method defined as an extension to
    `RPSystemBroadcastPickerView` has been deprecated in favor of
    `BroadcastManager.shared.requestActivation()`.

    ---------

    Co-authored-by: Hiroshi Horie <[email protected]>

commit 0da6660
Author: Jacob Gelman <[email protected]>
Date:   Thu Feb 13 05:55:25 2025 -0800

    Release automation (livekit#579)

    - Add version and platform compatibility badges from [Swift Package
    Index](https://swiftpackageindex.com/) to README
      - Automatically updated on each release
    - Add [nanpa](https://github.com/nbsp/nanpa) configuration
    - Custom script bumps version across repo (currently Podspec, README,
    and LiveKitSDK class)
      - GitHub publish workflow (based on workflow from livekit/rust-sdks)
    - Create workflow to push new releases to Cocopods when a release is
    published on GitHub

    I have also added changeset files to my currently open PRs (livekit#565, livekit#576,
    and livekit#573) that can be used to test this configuration.

    ---------

    Co-authored-by: Hiroshi Horie <[email protected]>

commit 5b031c8
Author: Hiroshi Horie <[email protected]>
Date:   Thu Feb 13 22:36:35 2025 +0900

    Update Podspec (livekit#587)

    Fixes: livekit#566

commit 485e76d
Author: Hiroshi Horie <[email protected]>
Date:   Wed Feb 12 14:36:48 2025 +0900

    macOS screen share audio (livekit#561)
hiroshihorie added a commit that referenced this pull request Feb 14, 2025
This PR revamps inter-process communication between the main app and the
broadcast extension, replacing deprecated Core Foundation APIs.
Additionally, it enhances testability, enables bi-directional
communication, and introduces a more flexible message structure.

Summary of new types:
- `IPCChannel`: An abstraction for inter-process communication, built on
top of the [Network](https://developer.apple.com/documentation/network)
framework. Allows asynchronous sending and receiving of messages
consisting of a dynamic header (any type conforming to `Codable`) and a
data payload.
- `BroadcastImageCodec`: Encapsulates functionality for
encoding/decoding image samples for transport. For now, this uses the
same method of JPEG encoding/decoding as the current implementation.
- `BroadcastUploader`: Sends samples from ReplayKit to the main app,
built on top of `IPCChannel`.
- `BroadcastReceiver`: Receives samples from the broadcast extension,
built on top of `IPCChannel`.

This PR sets the groundwork for adding support for audio samples, but I
decided to submit that in a separate PR (#576) as this is a large change
(though not breaking).

---------

Co-authored-by: Hiroshi Horie <[email protected]>
@hiroshihorie
Copy link
Member

hiroshihorie commented Feb 19, 2025

@ladvoc I think I removed DefaultAudioInputObserver.swift.

@ladvoc ladvoc marked this pull request as ready for review February 21, 2025 18:11
@hiroshihorie hiroshihorie self-requested a review February 21, 2025 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants