Open nguyenhy opened 1 year ago
We're making a desktop app for Windows and macOS users. In this app, there's a feature that allows the user to preview their camera and microphone in case users have more than one video/audio input device.
I'm so sorry that I might miss your point, is that mean you need to preview all the video/audio devices at the same time?
We're making a desktop app for Windows and macOS users. In this app, there's a feature that allows the user to preview their camera and microphone in case users have more than one video/audio input device.
I'm so sorry that I might miss your point, is that mean you need to preview all the video/audio devices at the same time?
So we need to preview 1 video/audio input device at a time while using it to push to channel. Like, preview a cam/mic before use it to push stream.
In our example, you can change and preview the device, and then you can control when to push with joinChannel
. I'm not very sure if it meets your requirement.
https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/blob/main/example/lib/examples/advanced/device_manager/device_manager.dart
And the main reason for this issue is that we need to show the volume meter
of current preview mic. I found that record
package allow use to do this.
But deviceId
from record
and agora_rtc_engine
is not the same. So even if we finish the feature, we can't select device using AudioDeviceManager.setRecordingDevice(deviceId)
In our example, you can change and preview the device, and then you can control when to push with
joinChannel
. I'm not very sure if it meets your requirement. https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/blob/main/example/lib/examples/advanced/device_manager/device_manager.dart
So our problem is that, saying we have 2 cameras: camA
and camB
. UserA
is using camA
to push the stream to other users in the channel and the user wants to swap the camera to camB
. But he wants to preview it before making the change.
So our feature is that we will show a list of the available cameras inside a preview dialog
. User can choose and preview it. Once he feels good he can click on the OK
button to use this camera to push stream to other users in the channel.
Somehow it looks like this
So, at the time they preview, we have 2 AgoraVideoView
. One in the preview dialog
and one in the main view
.
If we use VideoDeviceManager.setDevice(deviceId)
. Then it also means the main player is also changed to current preview camera.
Thanks for your detail, at this time our SDK only supports 2 cameras preview, you can try the VideoSourceType.videoSourceCameraSecondary
, I still need more info on how to preview others' video devices internally.
I still need more info on how to preview others' video devices internally.
I would love to know how to do it. Thanks for your support
@nguyenhy The deviceID returned by our SDK is also the deviceID returned by macOS system. Can you please try directly put the device ID returned by our SDK to the deviceID of other SDKs to see if it will work? Maybe they have different numbers but can both be used? Please let us know your test result.
Hi @qiuyanli1990.
Can you please try directly put the device ID returned by our SDK to the deviceID of other SDKs to see if it will work? Maybe they have different numbers but can both be used? Please let us know your test result.
I did try to use agora ID in record
package but it not work.
@nguyenhy The deviceID returned by our SDK is also the deviceID returned by macOS system.
I'm really not sure about this. I try to create sample code from swift
and objective-c
but seem like it all return the same result. And every time I plug in and out my camera, Agora SDK
returns a new different id.
// macOS Objective-C
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeAudio];
for (AVCaptureDevice *device in devices) {
NSLog(@"=======");
NSLog(@"localizedName: %@", device.localizedName);
NSLog(@"uniqueID: %@", device.uniqueID);
NSLog(@"modelID: %@", device.modelID);
}
=======
localizedName: Unknown USB Audio Device
uniqueID: AppleUSBAudioEngine:Unknown Manufacturer:Unknown USB Audio Device:5F6D2E80:3
modelID: Unknown USB Audio Device:046D:0825
=======
localizedName: Unknown USB Audio Device
uniqueID: AppleUSBAudioEngine:Unknown Manufacturer:Unknown USB Audio Device:33829440:3
modelID: Unknown USB Audio Device:046D:0825
// macOS Swift
let discoverySession = AVCaptureDevice.DiscoverySession(
deviceTypes: [.builtInMicrophone],
mediaType: .audio, position: .unspecified
)
for device in discoverySession.devices {
print("===========")
print("localizedName: ", device.localizedName);
print("uniqueID: ", device.uniqueID);
print("modelID: ", device.modelID);
}
===========
localizedName: Unknown USB Audio Device
uniqueID: AppleUSBAudioEngine:Unknown Manufacturer:Unknown USB Audio Device:5F6D2E80:3
modelID: Unknown USB Audio Device:046D:0825
===========
localizedName: Unknown USB Audio Device
uniqueID: AppleUSBAudioEngine:Unknown Manufacturer:Unknown USB Audio Device:33829440:3
modelID: Unknown USB Audio Device:046D:0825
Can you help me point out how to create this int
id so we can somehow create ourself adapter to retrieve String
id as in uniqueID
For your feature, I think you can try using startSecondaryCameraCapture to preview the selected deviceId
For your feature, I think you can try using startSecondaryCameraCapture to preview the selected deviceId
As I mention ealier, the main reason for this issue is that the deviceId
from Agora SDK
is not the device id of plugin devices.
You can read more about this in this comment
And every time I plug in and out my camera, Agora SDK returns a new different id.
https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/issues/960#issuecomment-1473434723
So we need to preview 1 video/audio input device at a time while using it to push to channel. Like, preview a cam/mic before use it to push stream.
I think this can be achieved by using the startSecondaryCameraCapture and preview it without using the other packages, you can check our example for reference.
Capture by a deviceId: https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/blob/216eb04fddf6d2a81a75f9c37295e2d593bb9ba4/example/lib/examples/advanced/send_multi_camera_stream/send_multi_camera_stream.dart#L233
Ok, I will check startSecondaryCameraCapture.
But how about deviceId
of audioDevices
and videoDevices
not the same. And every time I plug in and out my camera, Agora SDK returns a new different id for audioDevices
.
final engine = createAgoraRtcEngine();
engine
.initialize(
const RtcEngineContext(
appId: appId,
),
)
.then((value) async {
final videoManager = engine.getVideoDeviceManager();
final audioManager = engine.getAudioDeviceManager();
final videoDevices = await videoManager.enumerateVideoDevices();
final audioDevices = await audioManager.enumerateRecordingDevices();
for (var element in videoDevices) {
print(['videoDevices', element.deviceId, element.deviceName]);
}
/// [Log]
/// flutter: [videoDevices, 0x2100000046d0825, USB Camera VID:1133 PID:2085]
/// flutter: [videoDevices, 0x2200000046d0825, USB Camera VID:1133 PID:2085]
for (var element in audioDevices) {
print(['audioDevices', element.deviceId, element.deviceName]);
}
/// flutter: [audioDevices, 99, default (Unknown USB Audio Device)]
/// flutter: [audioDevices, 95, Unknown USB Audio Device]
});
Describe the bug We're making a desktop app for Windows and macOS users. In this app, there's a feature that allows the user to preview their camera and microphone in case users have more than one video/audio input device.
We decide to use another package to make this, since we can't stream from the one cam/mic and preview the exact cam/mic to allow user previews their cam/mic. Because we can't find a solution to use the same cam/mic one for stream and one for preview, and these 2 have different configs. Even, when we create 2 different
RtcEngine
with the same/differentappId
With record and camera_macos. We were able to make it but there's one problem. The
deviceId
return from these 2 packages is different than thedeviceId
fromAgora SDK
To Reproduce Note that I plugin in 2 similar camera
As shown in the above sample code,
record
, andcamera_macos
are able to return the same id for audio input devices, whichs isAppleUSBAudioEngine:Unknown Manufacturer:Unknown USB Audio Device:D5ACA760:3
andAppleUSBAudioEngine:Unknown Manufacturer:Unknown USB Audio Device:33829440:3
. But the id fromenumerateRecordingDevices
return is95
,99
.Expected behavior method
enumerateRecordingDevices
return value ofdeviceId
as other packageDesktop (please complete the following information):