Skip to content

Commit 0733fc1

Browse files
authored
Merge pull request #1057 from Unity-Technologies/dw24-media-stream-track
doc: Improve documentation of MediaStreamTrack
2 parents ee44344 + ccfb6cd commit 0733fc1

File tree

1 file changed

+41
-8
lines changed

1 file changed

+41
-8
lines changed

Runtime/Scripts/MediaStreamTrack.cs

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,27 @@
44
namespace Unity.WebRTC
55
{
66
/// <summary>
7-
///
7+
/// Represents a single media track within a stream.
88
/// </summary>
9+
/// <remarks>
10+
/// `MediaStreamTrack` represents a single media track within a stream.
11+
/// Typically, these are audio or video tracks, but other track types may exist as well.
12+
/// Each track is associated with a `MediaStream` object.
13+
/// </remarks>
14+
/// <example>
15+
/// <code lang="cs"><![CDATA[
16+
/// IEnumerable<MediaStreamTrack> mediaStreamTracks = mediaStream.GetTracks();
17+
/// ]]></code>
18+
/// </example>
19+
/// <seealso cref="MediaStream"/>
920
public class MediaStreamTrack : RefCountedObject
1021
{
1122
/// <summary>
12-
///
23+
/// Boolean value that indicates whether the track is allowed to render the source stream.
1324
/// </summary>
25+
/// <remarks>
26+
/// When the value is `true`, a track's data is output from the source to the destination; otherwise, empty frames are output.
27+
/// </remarks>
1428
public bool Enabled
1529
{
1630
get
@@ -24,19 +38,19 @@ public bool Enabled
2438
}
2539

2640
/// <summary>
27-
///
41+
/// TrackState value that describes the status of the track.
2842
/// </summary>
2943
public TrackState ReadyState =>
3044
NativeMethods.MediaStreamTrackGetReadyState(GetSelfOrThrow());
3145

3246
/// <summary>
33-
///
47+
/// TrackKind value that describes the type of media for the track.
3448
/// </summary>
3549
public TrackKind Kind =>
3650
NativeMethods.MediaStreamTrackGetKind(GetSelfOrThrow());
3751

3852
/// <summary>
39-
///
53+
/// String containing a unique identifier (GUID) for the track.
4054
/// </summary>
4155
public string Id =>
4256
NativeMethods.MediaStreamTrackGetID(GetSelfOrThrow()).AsAnsiStringWithFreeMem();
@@ -47,16 +61,27 @@ internal MediaStreamTrack(IntPtr ptr) : base(ptr)
4761
}
4862

4963
/// <summary>
50-
///
64+
/// Finalizer for MediaStreamTrack.
5165
/// </summary>
66+
/// <remarks>
67+
/// Ensures that resources are released by calling the `Dispose` method
68+
/// </remarks>
5269
~MediaStreamTrack()
5370
{
5471
this.Dispose();
5572
}
5673

5774
/// <summary>
58-
///
75+
/// Disposes of MediaStreamTrack.
5976
/// </summary>
77+
/// <remarks>
78+
/// `Dispose` method disposes of the `MediaStreamTrack` and releases the associated resources.
79+
/// </remarks>
80+
/// <example>
81+
/// <code lang="cs"><![CDATA[
82+
/// mediaStreamTrack.Dispose();
83+
/// ]]></code>
84+
/// </example>
6085
public override void Dispose()
6186
{
6287
if (this.disposed)
@@ -72,8 +97,16 @@ public override void Dispose()
7297
}
7398

7499
/// <summary>
75-
/// Disassociate track from its source(video or audio), not for destroying the track
100+
/// Stops the track.
76101
/// </summary>
102+
/// <remarks>
103+
/// `Stop` method disassociates the track from its source (video or audio) without destroying the track.
104+
/// </remarks>
105+
/// <example>
106+
/// <code lang="cs"><![CDATA[
107+
/// mediaStreamTrack.Stop();
108+
/// ]]></code>
109+
/// </example>
77110
public void Stop()
78111
{
79112
WebRTC.Context.StopMediaStreamTrack(GetSelfOrThrow());

0 commit comments

Comments
 (0)