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

Feature/add features to device managers #99

Merged
merged 37 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
eb9da93
temp
sierpinskid Mar 12, 2024
a0ae96c
Add audio device recording & testing + add camera testing + properly …
sierpinskid Mar 13, 2024
8da73aa
Merge remote-tracking branch 'origin/main' into feature/add-features-…
sierpinskid Mar 20, 2024
03e946f
temp
sierpinskid Mar 22, 2024
0b1aeb6
Merge remote-tracking branch 'origin/main' into feature/add-features-…
sierpinskid Mar 22, 2024
38e625a
temp
sierpinskid Apr 10, 2024
93378ab
temp
sierpinskid Apr 16, 2024
62a1bf2
Merge branch 'feature/update-dtos-2' into feature/add-features-to-dev…
sierpinskid Apr 16, 2024
10a6c8b
Fix tests & testing for a video device that is actually capturing any…
sierpinskid Apr 16, 2024
add1192
Update example project to use new device managers
sierpinskid Apr 16, 2024
dce7f1e
Fix initialization order
sierpinskid Apr 17, 2024
3a1dbce
Select first working camera by default and the first microphone device
sierpinskid Apr 18, 2024
c04e68a
Refactor device panels to not keep any state and only rely on the dev…
sierpinskid Apr 18, 2024
8ef592c
Set resolution + remove obsolete microphone input game object in scene
sierpinskid Apr 18, 2024
faa7af8
Remove obsolete code
sierpinskid Apr 18, 2024
37d39b1
Merge branch 'main' into feature/add-features-to-device-managers
sierpinskid Apr 18, 2024
a1d4f89
Disable device by default & add device enable argument to SelectDevic…
sierpinskid Apr 22, 2024
551b5ea
Remove obsolete code
sierpinskid Apr 23, 2024
75475b1
sync imported & packages example projects
sierpinskid Apr 23, 2024
1a533cb
Add IsEnabledChanged event
sierpinskid Apr 24, 2024
fd2b4e8
Fix starting the camera again after changing the device
sierpinskid Apr 24, 2024
4d81762
Fix texture that we're passing to webRTC VideoStreamTrack
sierpinskid Apr 24, 2024
be6500a
Merge branch 'bugfix/downgrade-webrtc-package' into feature/add-featu…
sierpinskid Apr 24, 2024
5fbea75
If working device not found -> fallback to first device
sierpinskid Apr 24, 2024
2feeb43
add logcat package
sierpinskid Apr 24, 2024
b2c46f9
Add default settings for Android platform
sierpinskid Apr 24, 2024
a83a75e
sync sample projects
sierpinskid Apr 24, 2024
1e3f9b1
review fixes
sierpinskid Apr 25, 2024
4119d89
[Docs] Update quickstart guide to use device managers
sierpinskid Apr 25, 2024
8ecc4fb
[Docs] quickstart fixes
sierpinskid Apr 25, 2024
dbec2bc
Rename argument
sierpinskid Apr 26, 2024
25d28e3
[Docs] Update camera & microphone guide to use new device managers
sierpinskid Apr 26, 2024
9f29222
[Docs] fix tables
sierpinskid Apr 26, 2024
9cdde1c
[Docs] fix format
sierpinskid Apr 26, 2024
a0d1d29
sync sample projects
sierpinskid Apr 29, 2024
7c7b72d
Rename audio & video device managers interfaces to contain Stream prefix
sierpinskid May 1, 2024
df8d8e3
Merge remote-tracking branch 'origin/main' into feature/add-features-…
sierpinskid May 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
serializedVersion: 3
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
Expand All @@ -117,7 +117,7 @@ NavMeshSettings:
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
Expand All @@ -128,6 +128,7 @@ PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 996985032}
m_Modifications:
- target: {fileID: 149840264038047480, guid: 117eea22f833ae64f95b5be7435be32d, type: 3}
Expand Down Expand Up @@ -587,6 +588,9 @@ PrefabInstance:
value: -40
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 117eea22f833ae64f95b5be7435be32d, type: 3}
--- !u!224 &123332879 stripped
RectTransform:
Expand Down Expand Up @@ -635,7 +639,6 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 996985032}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
Expand Down Expand Up @@ -740,13 +743,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 575041316}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &705507993
GameObject:
Expand Down Expand Up @@ -834,13 +837,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 705507993}
serializedVersion: 2
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &963194225
GameObject:
Expand Down Expand Up @@ -882,9 +885,17 @@ Camera:
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
Expand Down Expand Up @@ -918,13 +929,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &996985028
GameObject:
Expand Down Expand Up @@ -1003,7 +1014,9 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
Expand All @@ -1023,7 +1036,6 @@ RectTransform:
- {fileID: 1214904789}
- {fileID: 123332879}
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
Expand All @@ -1046,7 +1058,6 @@ MonoBehaviour:
_senderVideoWidth: 1280
_senderVideoHeight: 720
_senderVideoFps: 30
_inputAudioSource: {fileID: 1825738054}
_inputSceneCamera: {fileID: 963194227}
_callScreen: {fileID: 123332880}
_mainScreen: {fileID: 355221056687574256}
Expand Down Expand Up @@ -1096,147 +1107,20 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1354881823}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1825738053
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1825738055}
- component: {fileID: 1825738054}
m_Layer: 0
m_Name: MicrophoneInput
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!82 &1825738054
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1825738053}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!4 &1825738055
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1825738053}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &355221056687574255
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 996985032}
m_Modifications:
- target: {fileID: 355221055551435707, guid: 0718803385b9d8840b6d4f562c3d956a, type: 3}
Expand Down Expand Up @@ -1812,6 +1696,9 @@ PrefabInstance:
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 0718803385b9d8840b6d4f562c3d956a, type: 3}
--- !u!114 &355221056687574256 stripped
MonoBehaviour:
Expand All @@ -1824,3 +1711,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ecb25fba984048238b2cf9ae786dab82, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 1354881825}
- {fileID: 996985032}
- {fileID: 705507995}
- {fileID: 575041319}
- {fileID: 963194228}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ public class StreamVideoManager : MonoBehaviour
public event Action CallEnded;

public IStreamVideoClient Client { get; private set; }

public void Init()
{
_clientConfig = new StreamClientConfig
{
LogLevel = StreamLogLevel.Debug,
};

Client = StreamVideoClient.CreateDefaultClient(_clientConfig);
Client.CallStarted += OnCallStarted;
Client.CallEnded += OnCallEnded;
}

/// <summary>
/// Join the Call with a given ID. We can either create it or try to join only.
Expand Down Expand Up @@ -65,18 +77,6 @@ public void LeaveActiveCall()
/// </summary>
public void SetAudioREDundancyEncoding(bool value) => _clientConfig.Audio.EnableRed = value;

protected void Awake()
{
_clientConfig = new StreamClientConfig
{
LogLevel = StreamLogLevel.Debug,
};

Client = StreamVideoClient.CreateDefaultClient(_clientConfig);
Client.CallStarted += OnCallStarted;
Client.CallEnded += OnCallEnded;
}

protected async void Start()
{
var credentials = new AuthCredentials(_apiKey, _userId, _userToken);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using StreamVideo.Core.DeviceManagers;

namespace StreamVideo.ExampleProject.UI.Devices
{
public class CameraMediaDevicePanel : MediaDevicePanelBase
public class CameraMediaDevicePanel : MediaDevicePanelBase<CameraDeviceInfo>
{
protected override IEnumerable<string> GetDevicesNames() => WebCamTexture.devices.Select(d => d.name);
protected override CameraDeviceInfo SelectedDevice => Client.VideoDeviceManager.SelectedDevice;

protected override bool IsDeviceEnabled
{
get => Client.VideoDeviceManager.IsEnabled;
set => Client.VideoDeviceManager.SetEnabled(value);
}

protected override IEnumerable<CameraDeviceInfo> GetDevices() => Client.VideoDeviceManager.EnumerateDevices();

protected override string GetDeviceName(CameraDeviceInfo device) => device.Name;

protected override void ChangeDevice(CameraDeviceInfo device)
=> Client.VideoDeviceManager.SelectDevice(device, UIManager.SenderVideoResolution, IsDeviceEnabled,
UIManager.SenderVideoFps);

protected override void OnInit()
{
base.OnInit();

Client.VideoDeviceManager.SelectedDeviceChanged += OnSelectedDeviceChanged;
}

protected override void OnDestroying()
{
Client.VideoDeviceManager.SelectedDeviceChanged -= OnSelectedDeviceChanged;

base.OnDestroying();
}

private void OnSelectedDeviceChanged(CameraDeviceInfo previousDevice, CameraDeviceInfo currentDevice)
=> SelectDeviceWithoutNotify(currentDevice);
}
}
Loading
Loading