[MediaPlayer] add API to set zoom with field of view for spherical video (#329)
authornam <36914158+kqjy777@users.noreply.github.com>
Fri, 13 Jul 2018 02:59:59 +0000 (11:59 +0900)
committerGitHub <noreply@github.com>
Fri, 13 Jul 2018 02:59:59 +0000 (11:59 +0900)
* [MediaPlayer] add API to set zoom with field of view for spherical video

and modify the wrong descriptions

* fix descriptions

src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs
src/Tizen.Multimedia.MediaPlayer/Player/Player.cs
src/Tizen.Multimedia.MediaPlayer/Player/SphericalVideo.cs

index 6c50537..d0eeab1 100644 (file)
@@ -310,6 +310,9 @@ internal static partial class Interop
         [DllImport(Libraries.Player, EntryPoint = "player_360_get_field_of_view")]
         internal static extern PlayerErrorCode GetFieldOfView(IntPtr player, out int horizontalDegrees, out int verticalDegrees);
 
+        [DllImport(Libraries.Player, EntryPoint = "player_360_set_zoom_with_field_of_view")]
+        internal static extern PlayerErrorCode SetZoomWithFieldOfView(IntPtr player, float level, int horizontalDegrees, int verticalDegrees);
+
         [DllImport(Libraries.Player, EntryPoint = "player_foreach_adaptive_variant")]
         internal static extern PlayerErrorCode ForeachAdaptiveVariants(IntPtr player, AdaptiveVariantCallback callback, IntPtr userData);
 
index ea24ff6..092e124 100644 (file)
@@ -621,7 +621,7 @@ namespace Tizen.Multimedia
         ///     Streaming playback.
         /// </exception>
         /// <exception cref="ArgumentOutOfRangeException">
-        ///     <paramref name="rate"/> is less than 5.0.<br/>
+        ///     <paramref name="rate"/> is less than -5.0.<br/>
         ///     -or-<br/>
         ///     <paramref name="rate"/> is greater than 5.0.<br/>
         ///     -or-<br/>
index 86f60f5..d876399 100644 (file)
@@ -186,7 +186,6 @@ namespace Tizen.Multimedia
         /// <feature>http://tizen.org/feature/multimedia.player.spherical_video</feature>
         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
-        /// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
         /// <seealso cref="SetZoom(float)"/>
         /// <since_tizen> 5 </since_tizen>
         public float GetZoom()
@@ -210,7 +209,11 @@ namespace Tizen.Multimedia
         /// <feature>http://tizen.org/feature/multimedia.player.spherical_video</feature>
         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
-        /// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
+        /// <exception cref="ArgumentOutOfRangeException">
+        ///     <pramref name="level"/> is less than 1.0.
+        ///     -or-<br/>
+        ///     <paramref name="level"/> is greater than 10.0.<br/>
+        /// </exception>
         /// <seealso cref="GetZoom()"/>
         /// <since_tizen> 5 </since_tizen>
         public void SetZoom(float level)
@@ -231,8 +234,6 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Gets or sets the spherical mode.
         /// </summary>
-        /// <remarks>The player must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/>,
-        /// or <see cref="PlayerState.Paused"/> state.</remarks>
         /// <feature>http://tizen.org/feature/opengles.version.2_0</feature>
         /// <feature>http://tizen.org/feature/multimedia.player.spherical_video</feature>
         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
@@ -274,9 +275,6 @@ namespace Tizen.Multimedia
         /// <exception cref="ObjectDisposedException">
         /// The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed of.
         /// </exception>
-        /// <exception cref="InvalidOperationException">
-        /// The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.
-        /// </exception>
         /// <since_tizen> 5 </since_tizen>
         public DirectionOfView GetDirectionOfView()
         {
@@ -301,8 +299,10 @@ namespace Tizen.Multimedia
         /// <exception cref="ObjectDisposedException">
         /// The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed of.
         /// </exception>
-        /// <exception cref="InvalidOperationException">
-        /// The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.
+        /// <exception cref="ArgumentOutOfRangeException">
+        ///     <pramref name="directionOfView.Yaw"/> should be in range of [-3.141593, 3.141593].<br/>
+        ///     -or-<br/>
+        ///     <pramref name="directionOfView.Pitch"/> should be in range of [-1.570796, 1.570796].<br/>
         /// </exception>
         /// <seealso cref="DirectionOfView"/>
         /// <since_tizen> 5 </since_tizen>
@@ -339,9 +339,6 @@ namespace Tizen.Multimedia
         /// <exception cref="ObjectDisposedException">
         /// The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed of.
         /// </exception>
-        /// <exception cref="InvalidOperationException">
-        /// The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.
-        /// </exception>
         /// <since_tizen> 5 </since_tizen>
         public FieldOfView GetFieldOfView()
         {
@@ -366,8 +363,14 @@ namespace Tizen.Multimedia
         /// <exception cref="ObjectDisposedException">
         /// The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed of.
         /// </exception>
-        /// <exception cref="InvalidOperationException">
-        /// The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.
+        /// <exception cref="ArgumentOutOfRangeException">
+        ///     <pramref name="fieldOfView.HorizontalDegrees"/> is less than 1.<br/>
+        ///     -or-<br/>
+        ///     <pramref name="fieldOfView.HorizontalDegrees"/> is greater than 360.<br/>
+        ///     -or-<br/>
+        ///     <pramref name="fieldOfView.VerticalDegrees"/> is less than 1.<br/>
+        ///     -or-<br/>
+        ///     <pramref name="fieldOfView.VerticalDegrees"/> is greater than 180.<br/>
         /// </exception>
         /// <seealso cref="FieldOfView"/>
         /// <since_tizen> 5 </since_tizen>
@@ -393,5 +396,61 @@ namespace Tizen.Multimedia
             NativePlayer.SetFieldOfView(Player.Handle, fieldOfView.HorizontalDegrees, fieldOfView.VerticalDegrees).
                 ThrowIfFailed(Player, "Failed to set the field of the view.");
         }
+
+        /// <summary>
+        /// Sets the zoom with the field of view for spherical video.
+        /// </summary>
+        /// <param name="level">The zoom level.</param>
+        /// <param name="fieldOfView">The degree values to display.</param>
+        /// <feature>http://tizen.org/feature/opengles.version.2_0</feature>
+        /// <feature>http://tizen.org/feature/multimedia.player.spherical_video</feature>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
+        /// <exception cref="ObjectDisposedException">
+        /// The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed of.
+        /// </exception>
+        /// <exception cref="ArgumentOutOfRangeException">
+        ///     <pramref name="level"/> is less than 1.0.
+        ///     -or-<br/>
+        ///     <paramref name="level"/> is greater than 10.0.<br/>
+        ///     -or-<br/>
+        ///     <pramref name="fieldOfView.HorizontalDegrees"/> is less than 1.<br/>
+        ///     -or-<br/>
+        ///     <pramref name="fieldOfView.HorizontalDegrees"/> is greater than 360.<br/>
+        ///     -or-<br/>
+        ///     <pramref name="fieldOfView.VerticalDegrees"/> is less than 1.<br/>
+        ///     -or-<br/>
+        ///     <pramref name="fieldOfView.VerticalDegrees"/> is greater than 180.<br/>
+        /// </exception>
+        /// <seealso cref="FieldOfView"/>
+        /// <seealso cref="GetZoom()"/>
+        /// <seealso cref="GetFileOfView()"/>
+        /// <since_tizen> 5 </since_tizen>
+        public void SetZoomWithFieldOfView(float level, FieldOfView fieldOfView)
+        {
+            ValidationUtil.ValidateFeatureSupported(PlayerFeatures.OpenGl);
+            ValidationUtil.ValidateFeatureSupported(PlayerFeatures.SphericalVideo);
+
+            Player.ValidateNotDisposed();
+
+            if (level < 1.0F || 10.0F < level)
+            {
+                throw new ArgumentOutOfRangeException(nameof(level), level, "Valid level is 1.0 to 10.0");
+            }
+
+            if (fieldOfView.HorizontalDegrees < 1 || fieldOfView.HorizontalDegrees > 360)
+            {
+                throw new ArgumentOutOfRangeException(nameof(fieldOfView.HorizontalDegrees), fieldOfView.HorizontalDegrees,
+                    $"Valid range is 1-360 degrees. : " + fieldOfView.HorizontalDegrees);
+            }
+
+            if (fieldOfView.VerticalDegrees < 1 || fieldOfView.VerticalDegrees > 180)
+            {
+                throw new ArgumentOutOfRangeException(nameof(fieldOfView.VerticalDegrees), fieldOfView.VerticalDegrees,
+                    $"Valid range is 1-180 degrees. : " + fieldOfView.VerticalDegrees);
+            }
+
+            NativePlayer.SetZoomWithFieldOfView(Player.Handle, level, fieldOfView.HorizontalDegrees, fieldOfView.VerticalDegrees).
+                ThrowIfFailed(Player, "Failed to set the zoom with the field of the view.");
+        }
     }
 }