Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
39 changes: 39 additions & 0 deletions src/Tizen.Multimedia.MediaPlayer/Player/Player.Properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public IntPtr Handle
#region Network configuration
private string _cookie = "";
private string _userAgent = "";
private string _authorizationToken = "";
private const int MinBufferingTime = -1;

/// <summary>
Expand Down Expand Up @@ -151,6 +152,44 @@ public string UserAgent
}
}

/// <summary>
/// Gets or sets the authorization token for streaming playback.
/// </summary>
/// <remarks>
/// To set, the player must be in the <see cref="PlayerState.Idle"/> 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.
/// </remarks>
/// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <exception cref="ArgumentNullException">The value to set is null or empty.</exception>
/// <since_tizen> 14 </since_tizen>
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;
}
}

/// <summary>
/// Gets or sets the streaming buffering time.
/// </summary>
Expand Down
Loading