From: coderhyme Date: Wed, 31 May 2017 02:28:42 +0000 (+0900) Subject: [Player] Modified to detach sources when the resource conflict occurs. X-Git-Tag: submit/trunk/20170823.075128~94^2~56^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8e4265256167c9b36fcf245b67b009b2ff1da4cd;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [Player] Modified to detach sources when the resource conflict occurs. Native player automatically changes the state to unprepared when it occurs, so managed api shoud react accordingly. Change-Id: I1ea5df216d37d4cf2182bb8f4d3f6d077c4d908d Signed-off-by: coderhyme --- diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/Player.cs b/src/Tizen.Multimedia.MediaPlayer/Player/Player.cs index f147e59..d5dfb3c 100644 --- a/src/Tizen.Multimedia.MediaPlayer/Player/Player.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/Player.cs @@ -174,7 +174,6 @@ namespace Tizen.Multimedia return; } - Log.Warn(PlayerLog.Tag, "current state : " + State + ", desired state : " + string.Join(", ", desiredStates)); throw new InvalidOperationException($"The player is not in a valid state. " + $"Current State : { curState }, Valid State : { string.Join(", ", desiredStates) }."); } @@ -814,13 +813,14 @@ namespace Tizen.Multimedia NativePlayer.Unprepare(Handle).ThrowIfFailed("Failed to unprepare the player"); - if (_source != null) - { - _source.DetachFrom(this); - } - _source = null; + OnUnprepared(); } + protected virtual void OnUnprepared() + { + _source?.DetachFrom(this); + _source = null; + } //TODO remarks needs to be updated. see the native reference. /// @@ -1149,6 +1149,12 @@ namespace Tizen.Multimedia { return; } + + if (code == PlaybackInterruptionReason.ResourceConflict) + { + OnUnprepared(); + } + Log.Warn(PlayerLog.Tag, "interrupted reason : " + code); PlaybackInterrupted?.Invoke(this, new PlaybackInterruptedEventArgs(code)); };