mirror of
https://github.com/esphome/esphome.git
synced 2025-09-03 03:42:20 +01:00
Add supported formats to media player (#7318)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -1026,6 +1026,15 @@ bool APIConnection::send_media_player_info(media_player::MediaPlayer *media_play
|
||||
auto traits = media_player->get_traits();
|
||||
msg.supports_pause = traits.get_supports_pause();
|
||||
|
||||
for (auto &supported_format : traits.get_supported_formats()) {
|
||||
MediaPlayerSupportedFormat media_format;
|
||||
media_format.format = supported_format.format;
|
||||
media_format.sample_rate = supported_format.sample_rate;
|
||||
media_format.num_channels = supported_format.num_channels;
|
||||
media_format.purpose = static_cast<enums::MediaPlayerFormatPurpose>(supported_format.purpose);
|
||||
msg.supported_formats.push_back(media_format);
|
||||
}
|
||||
|
||||
return this->send_list_entities_media_player_response(msg);
|
||||
}
|
||||
void APIConnection::media_player_command(const MediaPlayerCommandRequest &msg) {
|
||||
|
Reference in New Issue
Block a user