diff --git a/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs b/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs index e48e2418f97..4385127fbc3 100644 --- a/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs @@ -195,6 +195,9 @@ internal static extern PlayerErrorCode SetAudioFrameDecodedCb(IntPtr player, Int [DllImport(Libraries.Player, EntryPoint = "player_set_streaming_user_agent")] internal static extern PlayerErrorCode SetStreamingUserAgent(IntPtr player, string userAgent, int size); + [DllImport(Libraries.Player, EntryPoint = "player_set_streaming_authorization_token")] + internal static extern PlayerErrorCode SetStreamingAuthorizationToken(IntPtr player, string token); + [DllImport(Libraries.Player, EntryPoint = "player_get_streaming_download_progress")] internal static extern PlayerErrorCode GetStreamingDownloadProgress(IntPtr player, out int start, out int current); diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/Player.Properties.cs b/src/Tizen.Multimedia.MediaPlayer/Player/Player.Properties.cs index 8ae7b692aac..74fd644ddb2 100644 --- a/src/Tizen.Multimedia.MediaPlayer/Player/Player.Properties.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/Player.Properties.cs @@ -89,6 +89,7 @@ public IntPtr Handle #region Network configuration private string _cookie = ""; private string _userAgent = ""; + private string _authorizationToken = ""; private const int MinBufferingTime = -1; /// @@ -151,6 +152,44 @@ public string UserAgent } } + /// + /// Gets or sets the authorization token for streaming playback. + /// + /// + /// To set, the player must be in the state. + /// The token must include the authentication scheme, such as "Bearer" or "Basic". + /// For example, pass "Bearer xxxxxx" for a bearer token, or "Basic xxxxxx" for a basic token. + /// The token is discarded once the streaming connection has been set up, + /// which means it has to be set again for each prepare cycle. + /// The token is sent only when the media is served over a secure connection. + /// A token of up to 2048 bytes is guaranteed to be accepted. + /// + /// The player is not in the valid state. + /// The player has already been disposed of. + /// The value to set is null or empty. + /// 14 + public string AuthorizationToken + { + get + { + return _authorizationToken; + } + set + { + ValidatePlayerState(PlayerState.Idle); + + if (string.IsNullOrEmpty(value)) + { + throw new ArgumentNullException(nameof(value), "AuthorizationToken can't be null or empty."); + } + + NativePlayer.SetStreamingAuthorizationToken(Handle, value). + ThrowIfFailed(this, "Failed to set the authorization token to the player"); + + _authorizationToken = value; + } + } + /// /// Gets or sets the streaming buffering time. ///