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

[BUG] Updating NetStream.multiCamCaptureSettings.Mode doesn't work #1345

Closed
RainyTunes opened this issue Dec 1, 2023 · 2 comments
Closed
Milestone

Comments

@RainyTunes
Copy link
Sponsor

Describe the bug

I found this bug and tested it in the Example Demo. Luckily I thought I had located the issue.

Just simply update the NetStream.multiCamCaptureSettings through the setter method, it doesn't work.

func switchToSideMode() {
    print("[LiveViewModel] switchToSideMode")
    stream.multiCamCaptureSettings = MultiCamCaptureSettings(
        mode: .splitView,  // set to .splitView through the setter method
        cornerRadius: 16.0,
        regionOfInterest: .init(
            origin: CGPoint(x: 16, y: 16),
            size: .init(width: 160, height: 160)
        ),
        direction: .east
    )
}

However, it works when I directly modify the library source code:

/// The default setting for the stream.
public static let `default` = MultiCamCaptureSettings(
//        mode: .pip, // this is the origin value
    mode: .splitView,  // I hardcoded the default value and it can take effect
    cornerRadius: 16.0,
    regionOfInterest: .init(
        origin: CGPoint(x: 16, y: 16),
        size: .init(width: 160, height: 160)
    ),
    direction: .east
)

Lastly, after debugging, I found where the bug came from:

/// Specifies the multi camera capture properties.
public var multiCamCaptureSettings: MultiCamCaptureSettings {
    get {
        mixer.videoIO.multiCamCaptureSettings
    }
    set {
        // it doesn't take effect
        mixer.videoIO.multiCamCaptureSettings = newValue

        // only the multiCamCaptureSettings.mode
        // from IOVideoMixer takes effect in multi-cam mode
        mixer.videoIO.videoMixer.multiCamCaptureSettings = newValue
        // (I changed the videoMixer property from private to public)
    }
}

I know the videoMixer should remain private.
However, I don't know how to solve this in a better way, or I can open a pull request.

To Reproduce

(update the Mode in NetStream.multiCamCaptureSettings through the setter method)

  1. the original value is expected to be .pip
  2. attach camera, public stream, connect streaming link
  3. change the Mode to .splitMode through the multiCamCaptureSettings setter method
  4. nothing happens although the multiCamCaptureSettings has already been modified

Expected behavior

The multi-cam Mode should be updated to .splitMode

Version

1.7.1
or
the newest main branch

Smartphone info.

iPhone 14pro

Additional context

No response

Screenshots

No response

Relevant log output

No response

@shogo4405 shogo4405 added this to the 1.7.2 milestone Dec 1, 2023
@shogo4405
Copy link
Owner

Thank you.

@RainyTunes
Copy link
Sponsor Author

You are welcome @shogo4405 . Thank you for your effort.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants