Improvement: NowPlaying overlay shows codec when Kodi is minimized to tray #1439
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR is related to xbmc/xbmc#19344 which was raised and discussed long ago with Kodi developers.
Background
The app uses
XBMC.GetInfoLabelsto read information on audio/video codecs of the current playing item and image/exif data when showing images. This information is displayed in the NowPlaying overlay. I personally have a use case (and maybe others as well), where Kodi is running on a headless system for music playback and is minimized to tray. When minimizing Kodi the info labels just not updated anymore and keep the data from the last time they were updated in non-minimized mode. The right solution is to usePlayer.GetPropertieswhich is always up-to-date.Problem with
Player.GetPropertiesis that this give an empty response for audiostrreams on Kodi versions < 19, and thatPlayer.GetPropertiesdoes not provide audiostream's bits-per-sample and video stream's aspect ratio and resolution.Approach
The approach taken is to let the app prefer data from
Player.GetPropertiesby reading this first, and only fill empty fields with information coming from 'XBMC.GetInfoLabels'. This keeps supporting Kodi < 19, and improves the user experience for headless systems (as mine 😊).Best would be to also see bits-per-sample, aspect ratio and resolution directly shared via
Player.GetProperties, I might raise a feature request to Kodi.As a side note: resolution can be derived from video's height by mimicking Kodi's logic to derive the resolution. For aspect ratio this does not work as expected, I saw differences for videos with dimensions of 352x288.
Summary for release notes
Improvement: NowPlaying overlay shows codec when Kodi is minimized to tray