diff --git a/docs/Changelog.md b/docs/Changelog.md index ea1acac..a3fa718 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -5,6 +5,7 @@ - Showing the playlist selects the currently played file/stream in the playlist. - Properties are shown in the command palette instead of the text editor making it very easy to find a property and show/print its value. +- Support for --keep-open=no. 5.4.9.1 Beta (2021-06-23) diff --git a/src/Misc/CorePlayer.cs b/src/Misc/CorePlayer.cs index ffdf54c..f12b7ec 100644 --- a/src/Misc/CorePlayer.cs +++ b/src/Misc/CorePlayer.cs @@ -100,6 +100,7 @@ namespace mpvnet public string SID { get; set; } = ""; public bool Border { get; set; } = true; + public bool FileEnded { get; set; } public bool Fullscreen { get; set; } public bool IsLogoVisible { set; get; } = true; public bool IsQuitNeeded { set; get; } = true; @@ -419,6 +420,7 @@ namespace mpvnet var reason = (mpv_end_file_reason)data.reason; InvokeAsync(EndFileAsync, reason); EndFile?.Invoke(reason); + FileEnded = true; } break; case mpv_event_id.MPV_EVENT_FILE_LOADED: @@ -528,8 +530,15 @@ namespace mpvnet InvokeEvent(TrackSwitched, TrackSwitchedAsync); break; case mpv_event_id.MPV_EVENT_IDLE: - ShowLogo(); InvokeEvent(Idle, IdleAsync); + + if (FileEnded) + { + ShowLogo(); + + if (GetPropertyString("keep-open") == "no") + Core.CommandV("quit"); + } break; case mpv_event_id.MPV_EVENT_PAUSE: Paused = true;