internal MediaCompositionBody(string id, MediaCompositionLayout layout, IDictionary <string, MediaInput> inputs, IDictionary <string, MediaOutput> outputs, CompositionStreamState?streamState) { Id = id; Layout = layout; Inputs = inputs; Outputs = outputs; StreamState = streamState; }
/// <param name="mediaCompositionId"> The media composition id of the composition to update. </param> /// <param name="layout"> The updated layout to compose media. </param> /// <param name="inputs"> The updated media inputs. </param> /// <param name="outputs"> The updated media outputs. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> public virtual Response <MediaCompositionBody> Update(string mediaCompositionId, MediaCompositionLayout layout = null, IDictionary <string, MediaInput> inputs = null, IDictionary <string, MediaOutput> outputs = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("MediaCompositionClient.Update"); scope.Start(); try { return(RestClient.Update(mediaCompositionId, mediaCompositionId, layout, inputs, outputs, null, cancellationToken)); } catch (Exception e) { scope.Failed(e); throw; } }
/// <param name="mediaCompositionId"> The media composition id. </param> /// <param name="layout"> The layout to compose the media. </param> /// <param name="inputs"> The media inputs. </param> /// <param name="outputs"> The media outputs. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> public virtual async Task <Response <MediaCompositionBody> > CreateAsync(string mediaCompositionId, MediaCompositionLayout layout, IDictionary <string, MediaInput> inputs, IDictionary <string, MediaOutput> outputs, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("MediaCompositionClient.Create"); scope.Start(); try { return(await RestClient.CreateAsync(mediaCompositionId, mediaCompositionId, layout, inputs, outputs, CompositionStreamState.NotStarted, cancellationToken).ConfigureAwait(false)); } catch (Exception e) { scope.Failed(e); throw; } }
internal static MediaCompositionBody DeserializeMediaCompositionBody(JsonElement element) { Optional <string> id = default; Optional <MediaCompositionLayout> layout = default; Optional <IDictionary <string, MediaInput> > inputs = default; Optional <IDictionary <string, MediaOutput> > outputs = default; Optional <CompositionStreamState> streamState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("layout")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } layout = MediaCompositionLayout.DeserializeMediaCompositionLayout(property.Value); continue; } if (property.NameEquals("inputs")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, MediaInput> dictionary = new Dictionary <string, MediaInput>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, MediaInput.DeserializeMediaInput(property0.Value)); } inputs = dictionary; continue; } if (property.NameEquals("outputs")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, MediaOutput> dictionary = new Dictionary <string, MediaOutput>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, MediaOutput.DeserializeMediaOutput(property0.Value)); } outputs = dictionary; continue; } if (property.NameEquals("streamState")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } streamState = new CompositionStreamState(property.Value.GetString()); continue; } } return(new MediaCompositionBody(id.Value, layout.Value, Optional.ToDictionary(inputs), Optional.ToDictionary(outputs), Optional.ToNullable(streamState))); }