Example #1
0
        /// <summary>
        /// Sets the field of view for spherical video.
        /// </summary>
        /// <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="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>
        public void SetFieldOfView(FieldOfView fieldOfView)
        {
            ValidationUtil.ValidateFeatureSupported(PlayerFeatures.OpenGl);
            ValidationUtil.ValidateFeatureSupported(PlayerFeatures.SphericalVideo);

            Player.ValidateNotDisposed();

            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.SetFieldOfView(Player.Handle, fieldOfView.HorizontalDegrees, fieldOfView.VerticalDegrees).
            ThrowIfFailed(Player, "Failed to set the field of the view.");
        }