[WebRTC] Add display feature for video APIs (#5442)
authorHaesu Gwon <haesu.gwon@samsung.com>
Wed, 9 Aug 2023 01:55:24 +0000 (10:55 +0900)
committerGitHub <noreply@github.com>
Wed, 9 Aug 2023 01:55:24 +0000 (10:55 +0900)
src/Tizen.Multimedia.Remoting/WebRTC/MediaScreenSource.cs
src/Tizen.Multimedia.Remoting/WebRTC/MediaSource.cs
src/Tizen.Multimedia.Remoting/WebRTC/MediaStreamTrack.cs
src/Tizen.Multimedia.Remoting/WebRTC/WebRTC.cs
src/Tizen.Multimedia.Remoting/WebRTC/WebRTCFeatures.cs

index 7be1574..391a13a 100755 (executable)
@@ -34,6 +34,11 @@ namespace Tizen.Multimedia.Remoting
         /// <summary>
         /// Initializes a new instance of the <see cref="MediaScreenSource"/> class.
         /// </summary>
+        /// <feature>http://tizen.org/feature/display</feature>
+        /// <remark>
+        /// If display feature is not supported, NotSupportedException will be thrown
+        /// when MediaScreenSource is added by <see cref="WebRTC.AddSource"/> or <see cref="WebRTC.AddSources"/>.
+        /// </remark>
         /// <since_tizen> 9 </since_tizen>
         public MediaScreenSource() : base(MediaType.Video) {}
 
index a4a2306..7768f69 100755 (executable)
@@ -615,6 +615,8 @@ namespace Tizen.Multimedia.Remoting
         /// Enables the video loopback. The local video will be diaplayed in <paramref name="display"/>.
         /// </summary>
         /// <param name="display">The <see cref="Display"/> to apply.</param>
+        /// <feature>http://tizen.org/feature/display</feature>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         /// <exception cref="ArgumentException">The display has already been assigned to another.</exception>
         /// <exception cref="ArgumentNullException"><paramref name="display"/> is null.</exception>
         /// <exception cref="InvalidOperationException">
@@ -628,6 +630,10 @@ namespace Tizen.Multimedia.Remoting
         {
             uint trackId = 0;
 
+            if (!Features.IsSupported(WebRTCFeatures.Display))
+            {
+                throw new NotSupportedException("Display feature is not supported.");
+            }
             if (!SourceId.HasValue)
             {
                 throw new InvalidOperationException("MediaSource is not attached yet. Call AddSource() first.");
index 3862f67..1d154e9 100755 (executable)
@@ -64,6 +64,8 @@ namespace Tizen.Multimedia.Remoting
         /// If remote track, <see cref="Display"/> must be set in <see cref="WebRTC.TrackAdded"/> event.<br/>
         /// The display is created with <see cref="MediaView"/>.
         /// </remarks>
+        /// <feature>http://tizen.org/feature/display</feature>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         /// <exception cref="ObjectDisposedException">The WebRTC has already been disposed of.</exception>
         /// <exception cref="ArgumentException">The value has already been assigned to another WebRTC.</exception>
         /// <exception cref="InvalidOperationException">
@@ -74,9 +76,22 @@ namespace Tizen.Multimedia.Remoting
         /// <since_tizen> 9 </since_tizen>
         public Display Display
         {
-            get => _display;
+            get
+            {
+                if (!Features.IsSupported(WebRTCFeatures.Display))
+                {
+                    throw new NotSupportedException("Display feature is not supported.");
+                }
+
+                return _display;
+            }
             set
             {
+                if (!Features.IsSupported(WebRTCFeatures.Display))
+                {
+                    throw new NotSupportedException("Display feature is not supported.");
+                }
+
                 if (Type != MediaType.Video)
                 {
                     throw new InvalidOperationException("This property is only for video track.");
@@ -122,6 +137,8 @@ namespace Tizen.Multimedia.Remoting
         /// <remarks>
         /// This property is meaningful only in overlay or EVAS surface display type.
         /// </remarks>
+        /// <feature>http://tizen.org/feature/display</feature>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         /// <value>A <see cref="WebRTCDisplayMode"/> that specifies the display mode.</value>
         /// <exception cref="ArgumentException">Display mode type is incorrect.</exception>
         /// <exception cref="InvalidOperationException"><see cref="Display"/> is not set.</exception>
@@ -130,6 +147,11 @@ namespace Tizen.Multimedia.Remoting
         {
             get
             {
+                if (!Features.IsSupported(WebRTCFeatures.Display))
+                {
+                    throw new NotSupportedException("Display feature is not supported.");
+                }
+
                 if (Type != MediaType.Video)
                 {
                     throw new InvalidOperationException("This property is only for video track.");
@@ -142,6 +164,11 @@ namespace Tizen.Multimedia.Remoting
             }
             set
             {
+                if (!Features.IsSupported(WebRTCFeatures.Display))
+                {
+                    throw new NotSupportedException("Display feature is not supported.");
+                }
+
                 if (Type != MediaType.Video)
                 {
                     throw new InvalidOperationException("This property is only for video track.");
@@ -161,12 +188,19 @@ namespace Tizen.Multimedia.Remoting
         /// <remarks>
         /// This property is meaningful only in overlay or EVAS surface display type.
         /// </remarks>
+        /// <feature>http://tizen.org/feature/display</feature>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         /// <exception cref="InvalidOperationException"><see cref="Display"/> is not set.</exception>
         /// <since_tizen> 9 </since_tizen>
         public bool DisplayVisible
         {
             get
             {
+                if (!Features.IsSupported(WebRTCFeatures.Display))
+                {
+                    throw new NotSupportedException("Display feature is not supported.");
+                }
+
                 if (Type != MediaType.Video)
                 {
                     throw new InvalidOperationException("This property is only for video track.");
@@ -179,6 +213,11 @@ namespace Tizen.Multimedia.Remoting
             }
             set
             {
+                if (!Features.IsSupported(WebRTCFeatures.Display))
+                {
+                    throw new NotSupportedException("Display feature is not supported.");
+                }
+
                 if (Type != MediaType.Video)
                 {
                     throw new InvalidOperationException("This property is only for video track.");
index dd6ecff..7564e86 100755 (executable)
@@ -386,6 +386,7 @@ namespace Tizen.Multimedia.Remoting
         /// <param name="source">The media sources to add.</param>
         /// <feature>http://tizen.org/feature/camera</feature>
         /// <feature>http://tizen.org/feature/microphone</feature>
+        /// <feature>http://tizen.org/feature/display</feature>
         /// <privilege>http://tizen.org/privilege/camera</privilege>
         /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
         /// <privilege>http://tizen.org/privilege/externalstorage</privilege>
@@ -433,6 +434,7 @@ namespace Tizen.Multimedia.Remoting
         /// <param name="sources">The media sources to add.</param>
         /// <feature>http://tizen.org/feature/camera</feature>
         /// <feature>http://tizen.org/feature/microphone</feature>
+        /// <feature>http://tizen.org/feature/display</feature>
         /// <privilege>http://tizen.org/privilege/camera</privilege>
         /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
         /// <privilege>http://tizen.org/privilege/externalstorage</privilege>
index b10644c..56c772d 100755 (executable)
@@ -21,5 +21,6 @@ namespace Tizen.Multimedia.Remoting
         internal const string Wifi = "http://tizen.org/feature/network.wifi";
         internal const string Telephony = "http://tizen.org/feature/network.telephony";
         internal const string Ethernet = "http://tizen.org/feature/network.ethernet";
+        internal const string Display = "http://tizen.org/feature/display";
     }
 }