X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.Multimedia.MediaPlayer%2FPlayer%2FPlayer.Properties.cs;h=2af4ce993b5a56c64f1c7884fe356e0e17150163;hb=78474c49c7ec2f128fbccbcf6a5a7f6773ef344c;hp=cd1e46b315e594189edb9dc5746faa7c8de3e3d9;hpb=32893539f0a3012884e1b74833438b4a1a1f176a;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/Player.Properties.cs b/src/Tizen.Multimedia.MediaPlayer/Player/Player.Properties.cs index cd1e46b..2af4ce9 100644 --- a/src/Tizen.Multimedia.MediaPlayer/Player/Player.Properties.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/Player.Properties.cs @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. @@ -24,6 +24,54 @@ using static Interop; namespace Tizen.Multimedia { + /// + /// Represents properties for streaming buffering time. + /// + /// 5 + public struct PlayerBufferingTime + { + /// + /// Initializes a new instance of the PlayerBufferingTime struct. + /// + /// A duration of buffering data that must be prerolled to start playback. + /// Except 0 and -1, setting at least 1000 milliseconds is recommended to ensure the normal buffering operation. + /// 0 : use platform default value which could be different depending on the streaming type and network status. (the initial value) + /// -1 : use current value. (since 5.5) + /// A duration of buffering data that must be prerolled to resume playback, + /// when player is internally paused for buffering. + /// Except 0 and -1, setting at least 1000 milliseconds is recommended to ensure the normal buffering operation. + /// 0 : use platform default value, which depends on the streaming type and network status. It is set as the initial value of this parameter. + /// If the player state is or , + /// this function will return correct time value instead of 0. (since 5.5) + /// -1 : use current value. (since 5.5) + /// 5 + public PlayerBufferingTime(int preBufferMillisecond = -1, int reBufferMillisecond = -1) + { + PreBufferMillisecond = preBufferMillisecond; + ReBufferMillisecond = reBufferMillisecond; + } + + /// + /// Gets or sets the duration of buffering data that must be prerolled to start playback. + /// + /// 5 + public int PreBufferMillisecond + { + get; + set; + } + + /// + /// Gets or sets the duration of buffering data that must be prerolled to resume playback + /// if player enters pause state for buffering. + /// + /// 5 + public int ReBufferMillisecond + { + get; + set; + } + } /// 3 public partial class Player { @@ -45,6 +93,7 @@ namespace Tizen.Multimedia #region Network configuration private string _cookie = ""; private string _userAgent = ""; + private const int MinBufferingTime = -1; /// /// Gets or sets the cookie for streaming playback. @@ -105,6 +154,46 @@ namespace Tizen.Multimedia _userAgent = value; } } + + /// + /// Gets or sets the streaming buffering time. + /// + /// To set, the player must be in the state. + /// The player is not in the valid state. + /// The player has already been disposed of. + /// + /// is less than -1.
+ /// -or-
+ /// is less than -1.
+ ///
+ /// The required feature is not supported. + /// + /// 5 + public PlayerBufferingTime BufferingTime + { + get + { + ValidateNotDisposed(); + + NativePlayer.GetStreamingBufferingTime(Handle, out var PreBuffMillisecond, out var ReBuffMillisecond). + ThrowIfFailed(this, "Failed to get the buffering time of the player"); + + return new PlayerBufferingTime(PreBuffMillisecond, ReBuffMillisecond); + } + set + { + ValidatePlayerState(PlayerState.Idle); + + if (value.PreBufferMillisecond < MinBufferingTime || value.ReBufferMillisecond < MinBufferingTime) + { + throw new ArgumentOutOfRangeException(nameof(value), value, + $"invalid range, got { value.PreBufferMillisecond }, { value.ReBufferMillisecond }."); + } + + NativePlayer.SetStreamingBufferingTime(Handle, value.PreBufferMillisecond, value.ReBufferMillisecond). + ThrowIfFailed(this, "Failed to set the buffering time of the player"); + } + } #endregion /// @@ -444,5 +533,148 @@ namespace Tizen.Multimedia ThrowIfFailed(this, "Failed to set the audio-only state of the player"); } } + + /// + /// Gets or sets the player's replaygain state. + /// + /// If the replaygain status is true, replaygain is applied (if contents has a replaygain tag); + /// otherwise, the replaygain is not affected by tag and properties. + /// The player has already been disposed of. + /// The player is not in the valid state. + /// 5 + public bool ReplayGain + { + get + { + ValidateNotDisposed(); + NativePlayer.IsReplayGain(Handle, out var value). + ThrowIfFailed(this, "Failed to get the replaygain of the player"); + return value; + } + set + { + ValidateNotDisposed(); + NativePlayer.SetReplayGain(Handle, value). + ThrowIfFailed(this, "Failed to set the replaygain of the player"); + } + } + + /// + /// Gets or sets the audio pitch. + /// + /// The value indicating whether or not AudioPitch is enabled. The default is false. + /// This function is used for audio content only. + /// To set, the player must be in the state. + /// The player is not in the valid state. + /// The player has already been disposed of. + /// + /// 6 + public bool AudioPitchEnabled + { + get + { + ValidateNotDisposed(); + NativePlayer.IsAudioPitchEnabled(Handle, out var value). + ThrowIfFailed(this, "Failed to get whether the audio pitch is enabled or not"); + return value; + } + + set + { + ValidateNotDisposed(); + ValidatePlayerState(PlayerState.Idle); + + NativePlayer.SetAudioPitchEnabled(Handle, value). + ThrowIfFailed(this, "Failed to enable the audio pitch of the player"); + } + } + + /// + /// Gets or sets the audio pitch value. + /// + /// The audio stream pitch value. The default is 1. + /// Enabling pitch control could increase the CPU usage on some devices. + /// This function is used for audio content only. + /// A pitch is not enabled. + /// The player has already been disposed of. + /// + /// value is less than 0.5. + /// -or-
+ /// value is greater than 2.0.
+ ///
+ /// + /// 6 + public float AudioPitch + { + get + { + ValidateNotDisposed(); + + if (AudioPitchEnabled == false) + { + throw new InvalidOperationException("An audio pitch is not enabled."); + } + + NativePlayer.GetAudioPitch(Handle, out var value). + ThrowIfFailed(this, "Failed to get the audio pitch"); + + return value; + } + + set + { + ValidateNotDisposed(); + + if (AudioPitchEnabled == false) + { + throw new InvalidOperationException("An audio pitch is not enabled."); + } + + if (value < 0.5F || 2.0F < value) + { + throw new ArgumentOutOfRangeException(nameof(value), value, "Valid value is 0.5 to 2.0"); + } + + NativePlayer.SetAudioPitch(Handle, value).ThrowIfFailed(this, "Failed to set the audio pitch"); + } + } + + private SphericalVideo _sphericalVideo; + + /// + /// Gets the spherical video settings. + /// + /// 5 + public SphericalVideo SphericalVideo + { + get + { + if (_sphericalVideo == null) + { + _sphericalVideo = new SphericalVideo(this); + } + + return _sphericalVideo; + } + } + + private AdaptiveVariants _adaptiveVariants; + + /// + /// Gets the adaptive variants settings. + /// + /// 5 + public AdaptiveVariants AdaptiveVariants + { + get + { + if (_adaptiveVariants == null) + { + _adaptiveVariants = new AdaptiveVariants(this); + } + + return _adaptiveVariants; + } + } } }