-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Media Streaming package parser with updated contracts (#31309)
* add media streaming package parser * fix build errors * change types of length and audiodata to int and str, respectively * resolve pr comments * remove public constructors * flatten contract
- Loading branch information
Showing
7 changed files
with
542 additions
and
0 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
...azure/communication/callautomation/implementation/models/MediaStreamingAudioInternal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.communication.callautomation.implementation.models; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
/** The MediaStreamingAudioInternal model. */ | ||
public final class MediaStreamingAudioInternal { | ||
|
||
/* | ||
* The audio data. | ||
*/ | ||
@JsonProperty(value = "data") | ||
private String audioData; | ||
|
||
/* | ||
* The timestamp of when the media was sourced. | ||
*/ | ||
@JsonProperty(value = "timestamp") | ||
private String timestamp; | ||
|
||
/* | ||
* The participantId. | ||
*/ | ||
@JsonProperty(value = "participantRawID") | ||
private String participantRawID; | ||
|
||
/* | ||
* Indicates if the received audio buffer contains only silence. | ||
*/ | ||
@JsonProperty(value = "silent") | ||
private boolean silent; | ||
|
||
/** | ||
* Get the data property. | ||
* | ||
* @return the data value. | ||
*/ | ||
public String getAudioData() { | ||
return audioData; | ||
} | ||
|
||
/** | ||
* Get the timestamp property. | ||
* | ||
* @return the timestamp value. | ||
*/ | ||
public String getTimestamp() { | ||
return timestamp; | ||
} | ||
|
||
/** | ||
* Get the participantRawID property. | ||
* | ||
* @return the participantRawID value. | ||
*/ | ||
public String getParticipantRawID() { | ||
return participantRawID; | ||
} | ||
|
||
/** | ||
* Get the silent property. | ||
* | ||
* @return the silent value. | ||
*/ | ||
public boolean isSilent() { | ||
return silent; | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
...re/communication/callautomation/implementation/models/MediaStreamingMetadataInternal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.communication.callautomation.implementation.models; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
/** The MediaStreamingMetadataInternal model. */ | ||
public final class MediaStreamingMetadataInternal { | ||
|
||
/* | ||
* The mediaSubscriptionId. | ||
*/ | ||
@JsonProperty(value = "subscriptionId") | ||
private String mediaSubscriptionId; | ||
|
||
/* | ||
* The encoding. | ||
*/ | ||
@JsonProperty(value = "encoding") | ||
private String encoding; | ||
|
||
/* | ||
* The sampleRate. | ||
*/ | ||
@JsonProperty(value = "sampleRate") | ||
private int sampleRate; | ||
|
||
/* | ||
* The channels. | ||
*/ | ||
@JsonProperty(value = "channels") | ||
private int channels; | ||
|
||
/* | ||
* The length. | ||
*/ | ||
@JsonProperty(value = "length") | ||
private int length; | ||
|
||
/** | ||
* Get the mediaSubscriptionId property. | ||
* | ||
* @return the mediaSubscriptionId value. | ||
*/ | ||
public String getMediaSubscriptionId() { | ||
return mediaSubscriptionId; | ||
} | ||
|
||
/** | ||
* Get the encoding property. | ||
* | ||
* @return the encoding value. | ||
*/ | ||
public String getEncoding() { | ||
return encoding; | ||
} | ||
|
||
/** | ||
* Get the sampleRate property. | ||
* | ||
* @return the sampleRate value. | ||
*/ | ||
public int getSampleRate() { | ||
return sampleRate; | ||
} | ||
|
||
/** | ||
* Get the channels property. | ||
* | ||
* @return the channels value. | ||
*/ | ||
public int getChannels() { | ||
return channels; | ||
} | ||
|
||
/** | ||
* Get the length property. | ||
* | ||
* @return the length value. | ||
*/ | ||
public int getLength() { | ||
return length; | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
...tion/src/main/java/com/azure/communication/callautomation/models/MediaStreamingAudio.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.communication.callautomation.models; | ||
|
||
import com.azure.communication.common.CommunicationIdentifier; | ||
import com.azure.communication.common.CommunicationUserIdentifier; | ||
|
||
import java.time.OffsetDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
/** The MediaStreamingAudio model. */ | ||
public class MediaStreamingAudio extends MediaStreamingPackageBase { | ||
|
||
/* | ||
* The audio data. | ||
*/ | ||
private final String audioData; | ||
|
||
/* | ||
* The timestamp of when the media was sourced. | ||
*/ | ||
private final OffsetDateTime timestamp; | ||
|
||
/* | ||
* The participantId. | ||
*/ | ||
private final CommunicationIdentifier participant; | ||
|
||
/* | ||
* Indicates if the received audio buffer contains only silence. | ||
*/ | ||
private final boolean silent; | ||
|
||
/** | ||
* The constructor | ||
* | ||
* @param audioData The audio data. | ||
* @param timestamp The timestamp of when the media was sourced. | ||
* @param participantRawID The participantId. | ||
* @param silent Indicates if the received audio buffer contains only silence. | ||
*/ | ||
MediaStreamingAudio(String audioData, String timestamp, String participantRawID, boolean silent) { | ||
this.audioData = audioData; | ||
this.timestamp = OffsetDateTime.parse(timestamp, DateTimeFormatter.ISO_OFFSET_DATE_TIME); | ||
this.participant = new CommunicationUserIdentifier(participantRawID); | ||
this.silent = silent; | ||
} | ||
|
||
/** | ||
* Get the data property. | ||
* | ||
* @return the data value. | ||
*/ | ||
public String getAudioData() { | ||
return audioData; | ||
} | ||
|
||
/** | ||
* Get the timestamp property. | ||
* | ||
* @return the timestamp value. | ||
*/ | ||
public OffsetDateTime getTimestamp() { | ||
return timestamp; | ||
} | ||
|
||
/** | ||
* Get the participantRawID property. | ||
* | ||
* @return the participantRawID value. | ||
*/ | ||
public CommunicationIdentifier getParticipant() { | ||
return participant; | ||
} | ||
|
||
/** | ||
* Get the silent property. | ||
* | ||
* @return the silent value. | ||
*/ | ||
public boolean isSilent() { | ||
return silent; | ||
} | ||
} |
95 changes: 95 additions & 0 deletions
95
...n/src/main/java/com/azure/communication/callautomation/models/MediaStreamingMetadata.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.communication.callautomation.models; | ||
|
||
/** The MediaStreamingMetadata model. */ | ||
public class MediaStreamingMetadata extends MediaStreamingPackageBase { | ||
|
||
/* | ||
* The mediaSubscriptionId. | ||
*/ | ||
private final String mediaSubscriptionId; | ||
|
||
/* | ||
* The encoding. | ||
*/ | ||
private final String encoding; | ||
|
||
/* | ||
* The sampleRate. | ||
*/ | ||
private final int sampleRate; | ||
|
||
/* | ||
* The channels. | ||
*/ | ||
private final int channels; | ||
|
||
/* | ||
* The length. | ||
*/ | ||
private final int length; | ||
|
||
/** | ||
* The constructor | ||
* | ||
* @param mediaSubscriptionId The mediaSubscriptionId. | ||
* @param encoding The encoding. | ||
* @param sampleRate The sampleRate. | ||
* @param channels The channels. | ||
* @param length The length. | ||
*/ | ||
MediaStreamingMetadata(String mediaSubscriptionId, String encoding, int sampleRate, int channels, int length) { | ||
this.mediaSubscriptionId = mediaSubscriptionId; | ||
this.encoding = encoding; | ||
this.sampleRate = sampleRate; | ||
this.channels = channels; | ||
this.length = length; | ||
} | ||
|
||
/** | ||
* Get the mediaSubscriptionId property. | ||
* | ||
* @return the mediaSubscriptionId value. | ||
*/ | ||
public String getMediaSubscriptionId() { | ||
return mediaSubscriptionId; | ||
} | ||
|
||
/** | ||
* Get the encoding property. | ||
* | ||
* @return the encoding value. | ||
*/ | ||
public String getEncoding() { | ||
return encoding; | ||
} | ||
|
||
/** | ||
* Get the sampleRate property. | ||
* | ||
* @return the sampleRate value. | ||
*/ | ||
public int getSampleRate() { | ||
return sampleRate; | ||
} | ||
|
||
/** | ||
* Get the channels property. | ||
* | ||
* @return the channels value. | ||
*/ | ||
public int getChannels() { | ||
return channels; | ||
} | ||
|
||
/** | ||
* Get the length property. | ||
* | ||
* @return the length value. | ||
*/ | ||
public int getLength() { | ||
return length; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...rc/main/java/com/azure/communication/callautomation/models/MediaStreamingPackageBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.communication.callautomation.models; | ||
|
||
/** The abstract classed used as parent of MediaStreaming[package type]. */ | ||
public abstract class MediaStreamingPackageBase { | ||
} |
Oops, something went wrong.