Example #1
0
        /// <summary>
        /// Sets the direction of view for spherical video.
        /// </summary>
        /// <param name="directionOfView">The angle values around the vertical and lateral axis.</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="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>
        public void SetDirectionOfView(DirectionOfView directionOfView)
        {
            ValidationUtil.ValidateFeatureSupported(PlayerFeatures.OpenGl);
            ValidationUtil.ValidateFeatureSupported(PlayerFeatures.SphericalVideo);

            Player.ValidateNotDisposed();

            if (directionOfView.Yaw > (float)Math.PI || directionOfView.Yaw < -(float)Math.PI)
            {
                throw new ArgumentOutOfRangeException(nameof(directionOfView.Yaw), directionOfView.Yaw,
                                                      $"Valid values are in range [-PI, PI] : " + directionOfView.Yaw);
            }

            if (directionOfView.Pitch > (float)Math.PI / 2 || directionOfView.Pitch < -(float)Math.PI / 2)
            {
                throw new ArgumentOutOfRangeException(nameof(directionOfView.Pitch), directionOfView.Pitch,
                                                      $"Valid values are in range [-PI/2, PI/2] : " + directionOfView.Pitch);
            }

            NativePlayer.SetDirectionOfView(Player.Handle, (float)directionOfView.Yaw, (float)directionOfView.Pitch).
            ThrowIfFailed(Player, "Failed to set the direction of the view.");
        }