mirror of
https://github.com/esphome/esphome.git
synced 2025-10-27 05:03:48 +00:00
27 lines
683 B
C++
27 lines
683 B
C++
#pragma once
|
|
|
|
#include "speaker_media_player.h"
|
|
|
|
#ifdef USE_ESP_IDF
|
|
|
|
#include "esphome/components/audio/audio.h"
|
|
#include "esphome/core/automation.h"
|
|
|
|
namespace esphome {
|
|
namespace speaker {
|
|
|
|
template<typename... Ts> class PlayOnDeviceMediaAction : public Action<Ts...>, public Parented<SpeakerMediaPlayer> {
|
|
TEMPLATABLE_VALUE(audio::AudioFile *, audio_file)
|
|
TEMPLATABLE_VALUE(bool, announcement)
|
|
TEMPLATABLE_VALUE(bool, enqueue)
|
|
void play(Ts... x) override {
|
|
this->parent_->play_file(this->audio_file_.value(x...), this->announcement_.value(x...),
|
|
this->enqueue_.value(x...));
|
|
}
|
|
};
|
|
|
|
} // namespace speaker
|
|
} // namespace esphome
|
|
|
|
#endif
|