{
ValidateNotDisposed();
- //TODO is this needed?
if (IsPreparing())
{
return PlayerState.Preparing;
private PlayerErrorCode SetDisplay(Display display)
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
if (display == null)
{
Log.Info(PlayerLog.Tag, "set display to none");
private void ReplaceDisplay(Display newDisplay)
{
- if (_display != null)
- {
- _display.Owner = null;
- }
+ _display?.SetOwner(null);
_display = newDisplay;
- if (_display != null)
- {
- _display.Owner = this;
- }
+ _display?.SetOwner(this);
}
/// <summary>
}
set
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
ValidatePlayerState(PlayerState.Idle);
- if (value != null && value.Owner != null)
+ if (value?.Owner != null)
{
if (ReferenceEquals(this, value.Owner))
{
return;
}
- else
- {
- throw new ArgumentException("The display has already been assigned to another.");
- }
- }
+ throw new ArgumentException("The display has already been assigned to another.");
+ }
SetDisplay(value).ThrowIfFailed("Failed to set the display to the player");
ReplaceDisplay(value);
- Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
}
}
_source = null;
}
- //TODO remarks needs to be updated. see the native reference.
/// <summary>
/// Starts or resumes playback.
/// </summary>
/// <remarks>
/// The player must be in the <see cref="PlayerState.Ready"/> or <see cref="PlayerState.Paused"/> state.
- /// It has no effect if the player is already in the <see cref="PlayerState.Playing"/> state.
+ /// It has no effect if the player is already in the <see cref="PlayerState.Playing"/> state.\n
+ /// \n
+ /// Sound can be mixed with other sounds if you don't control the stream focus using <see cref="ApplyAudioStreamPolicy"/>.
/// </remarks>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
/// <seealso cref="Stop"/>
/// <seealso cref="Pause"/>
/// <seealso cref="PlaybackCompleted"/>
+ /// <seealso cref="ApplyAudioStreamPolicy"/>
public virtual void Start()
{
Log.Debug(PlayerLog.Tag, PlayerLog.Enter);