@@ -34,14 +34,12 @@ Enable automatic audio streaming when the call is established by setting the fla
34
34
This setting ensures that audio streaming starts automatically as soon as the call is connected.
35
35
36
36
``` C#
37
- var mediaStreamingOptions = new MediaStreamingOptions (
38
- new Uri (" wss://YOUR_WEBSOCKET_URL" ),
39
- MediaStreamingContent .Audio ,
40
- MediaStreamingAudioChannel .Mixed ,
41
- startMediaStreaming : true ) {
42
- EnableBidirectional = true ,
43
- AudioFormat = AudioFormat .Pcm24KMono
44
- }
37
+ MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions (MediaStreamingAudioChannel .Unmixed );
38
+ mediaStreamingOptions .TransportUri = new Uri (websocketUri );
39
+ mediaStreamingOptions .EnableBidirectional = true ;
40
+ mediaStreamingOptions .AudioFormat = AudioFormat .Pcm24KMono ;
41
+ mediaStreamingOptions .EnableDtmfTones = true ;
42
+
45
43
var options = new AnswerCallOptions (incomingCallContext , callbackUri ) {
46
44
MediaStreamingOptions = mediaStreamingOptions ,
47
45
};
@@ -56,14 +54,12 @@ When Azure Communication Services receives the URL for your WebSocket server, it
56
54
To start media streaming during the call, you can use the API. To do so, set the ` startMediaStreaming ` parameter to ` false ` (which is the default), and later in the call, you can use the start API to enable media streaming.
57
55
58
56
``` C#
59
- var mediaStreamingOptions = new MediaStreamingOptions (
60
- new Uri (" wss://<YOUR_WEBSOCKET_URL" ),
61
- MediaStreamingContent .Audio ,
62
- MediaStreamingAudioChannel .Mixed ,
63
- startMediaStreaming : false ) {
64
- EnableBidirectional = true ,
65
- AudioFormat = AudioFormat .Pcm24KMono
66
- }
57
+ MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions (MediaStreamingAudioChannel .Unmixed );
58
+ mediaStreamingOptions .TransportUri = new Uri (websocketUri );
59
+ mediaStreamingOptions .EnableBidirectional = true ;
60
+ mediaStreamingOptions .AudioFormat = AudioFormat .Pcm24KMono ;
61
+ mediaStreamingOptions .EnableDtmfTones = true ;
62
+
67
63
var options = new AnswerCallOptions (incomingCallContext , callbackUri ) {
68
64
MediaStreamingOptions = mediaStreamingOptions ,
69
65
};
@@ -72,10 +68,11 @@ AnswerCallResult answerCallResult = await client.AnswerCallAsync(options);
72
68
73
69
Start media streaming via API call
74
70
StartMediaStreamingOptions options = new StartMediaStreamingOptions () {
75
- OperationContext = " startMediaStreamingContext"
71
+ OperationContext = " startMediaStreamingContext" ,
72
+ OperationCallbackUri = eventCallbackUri
76
73
};
77
74
78
- await callMedia .StartMediaStreamingAsync ();
75
+ await callMedia .StartMediaStreamingAsync (options );
79
76
```
80
77
81
78
@@ -86,10 +83,11 @@ To stop receiving audio streams during a call, you can use the **Stop streaming
86
83
87
84
``` C#
88
85
StopMediaStreamingOptions options = new StopMediaStreamingOptions () {
89
- OperationContext = " stopMediaStreamingContext"
86
+ OperationContext = " stopMediaStreamingContext" ,
87
+ OperationCallbackUri = eventCallbackUri
90
88
};
91
89
92
- await callMedia .StopMediaStreamingAsync ();
90
+ await callMedia .StopMediaStreamingAsync (options );
93
91
```
94
92
95
93
## Handling audio streams in your websocket server
0 commit comments