Skip to content

Commit 99ac63a

Browse files
minnieliuMinnie Liumikehang-msft
authored
[Media Composition] Introducing polymorphic models (#30365)
* Initial changes for refactoring polymorphic models * Update MediaCompositionClient Sample with new model classes. * Regenerating based on polymorphic model changes in swagger * Updating apiview and code snippets Co-authored-by: Minnie Liu <peiliu@microsoft.com> Co-authored-by: Mike Hang <mikehang@microsoft.com>
1 parent 388a5bc commit 99ac63a

File tree

151 files changed

+9889
-8204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+9889
-8204
lines changed

sdk/communication/Azure.Communication.MediaComposition/README.md

Lines changed: 37 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -48,69 +48,50 @@ var client = new MediaCompositionClient(endpoint, tokenCredential);
4848
### Creating the media composition
4949

5050
```C# Snippet:CreateMediaComposition
51-
var gridLayoutOptions = new GridLayoutOptions(2, 2);
52-
gridLayoutOptions.InputIds.Add(new List<string> { "jill", "jack" });
53-
gridLayoutOptions.InputIds.Add(new List<string> { "jane", "jerry" });
54-
var layout = new MediaCompositionLayout()
51+
var layout = new GridLayout(2, 2, new List<List<string>>{ new List<string> { "jill", "jack" }, new List<string> { "jane", "jerry" } })
5552
{
56-
Resolution = new(1920, 1080),
57-
Grid = gridLayoutOptions
53+
Resolution = new(1920, 1080)
5854
};
5955

6056
var inputs = new Dictionary<string, MediaInput>()
6157
{
62-
["jill"] = new()
58+
["jill"] = new ParticipantInput
59+
(
60+
id: new() { MicrosoftTeamsUser = new("f3ba9014-6dca-4456-8ec0-fa03cfa2b7b7") },
61+
call: "teamsMeeting")
6362
{
64-
Participant = new(
65-
id: new() { MicrosoftTeamsUser = new("f3ba9014-6dca-4456-8ec0-fa03cfa2b7b7") },
66-
call: "teamsMeeting")
67-
{
68-
PlaceholderImageUri = "https://imageendpoint"
69-
}
63+
PlaceholderImageUri = "https://imageendpoint"
7064
},
71-
["jack"] = new()
65+
["jack"] = new ParticipantInput
66+
(
67+
id: new() { MicrosoftTeamsUser = new("fa4337b5-f13a-41c5-a34f-f2aa46699b61") },
68+
call: "teamsMeeting")
7269
{
73-
Participant = new(
74-
id: new() { MicrosoftTeamsUser = new("fa4337b5-f13a-41c5-a34f-f2aa46699b61") },
75-
call: "teamsMeeting")
76-
{
77-
PlaceholderImageUri = "https://imageendpoint"
78-
}
70+
PlaceholderImageUri = "https://imageendpoint"
7971
},
80-
["jane"] = new()
72+
["jane"] = new ParticipantInput
73+
(
74+
id: new() { MicrosoftTeamsUser = new("2dd69470-dc25-49cf-b5c3-f562f08bf3b2") },
75+
call: "teamsMeeting"
76+
)
8177
{
82-
Participant = new(
83-
id: new() { MicrosoftTeamsUser = new("2dd69470-dc25-49cf-b5c3-f562f08bf3b2") },
84-
call: "teamsMeeting")
85-
{
86-
PlaceholderImageUri = "https://imageendpoint"
87-
}
78+
PlaceholderImageUri = "https://imageendpoint"
8879
},
89-
["jerry"] = new()
80+
["jerry"] = new ParticipantInput
81+
(
82+
id: new() { MicrosoftTeamsUser = new("30e29fde-ac1c-448f-bb34-0f3448d5a677") },
83+
call: "teamsMeeting")
9084
{
91-
Participant = new(
92-
id: new() { MicrosoftTeamsUser = new("30e29fde-ac1c-448f-bb34-0f3448d5a677") },
93-
call: "teamsMeeting")
94-
{
95-
PlaceholderImageUri = "https://imageendpoint"
96-
}
85+
PlaceholderImageUri = "https://imageendpoint"
9786
},
98-
["teamsMeeting"] = new()
99-
{
100-
TeamsMeeting = new("https://teamsJoinUrl")
101-
}
87+
["teamsMeeting"] = new TeamsMeetingInput(teamsJoinUrl: "https://teamsJoinUrl")
10288
};
10389

10490
var outputs = new Dictionary<string, MediaOutput>()
10591
{
106-
{
107-
"acsGroupCall",
108-
new()
109-
{
110-
GroupCall = new("d12d2277-ffec-4e22-9979-8c0d8c13d193")
111-
}
112-
}
92+
["acsGroupCall"] = new GroupCallOutput("d12d2277-ffec-4e22-9979-8c0d8c13d193")
11393
};
94+
11495
var response = await mediaCompositionClient.CreateAsync(mediaCompositionId, layout, inputs, outputs);
11596
```
11697

@@ -124,15 +105,11 @@ var gridMediaCompositionResponse = await mediaCompositionClient.GetAsync(mediaCo
124105

125106
You can update the layout:
126107
```C# Snippet:UpdateLayout
127-
var layout = new MediaCompositionLayout()
108+
var layout = new AutoGridLayout(new List<string>() { "teamsMeeting" })
128109
{
129110
Resolution = new(720, 480),
130-
Presenter = new("jill", "jack")
131-
{
132-
SupportPosition = SupportPosition.BottomRight,
133-
SupportAspectRatio = 3 / 2
134-
}
135111
};
112+
136113
var response = await mediaCompositionClient.UpdateLayoutAsync(mediaCompositionId, layout);
137114
```
138115

@@ -142,16 +119,16 @@ You can upsert or remove inputs:
142119
```C# Snippet:UpsertInputs
143120
var inputsToUpsert = new Dictionary<string, MediaInput>()
144121
{
145-
["james"] = new()
122+
["james"] = new ParticipantInput
123+
(
124+
id: new() { MicrosoftTeamsUser = new("f3ba9014-6dca-4456-8ec0-fa03cfa2b70p") },
125+
call: "teamsMeeting"
126+
)
146127
{
147-
Participant = new(
148-
id: new() { MicrosoftTeamsUser = new("f3ba9014-6dca-4456-8ec0-fa03cfa2b70p") },
149-
call: "teamsMeeting")
150-
{
151-
PlaceholderImageUri = "https://imageendpoint"
152-
}
128+
PlaceholderImageUri = "https://imageendpoint"
153129
}
154130
};
131+
155132
var response = await mediaCompositionClient.UpsertInputsAsync(mediaCompositionId, inputsToUpsert);
156133
```
157134

@@ -167,14 +144,9 @@ You can also upsert or remove outputs:
167144
```C# Snippet:UpsertOutputs
168145
var outputsToUpsert = new Dictionary<string, MediaOutput>()
169146
{
170-
{
171-
"youtube",
172-
new()
173-
{
174-
Rtmp = new("key", new(1920, 1080), "rtmp://a.rtmp.youtube.com/live2")
175-
}
176-
}
147+
["youtube"] = new RtmpOutput("key", new(1920, 1080), "rtmp://a.rtmp.youtube.com/live2")
177148
};
149+
178150
var response = await mediaCompositionClient.UpsertOutputsAsync(mediaCompositionId, outputsToUpsert);
179151
```
180152

0 commit comments

Comments
 (0)