mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	fix: changing the content source when playing is paused blocks the player (#6454)
This commit is contained in:
		| @@ -12,12 +12,12 @@ static const char *const TAG = "audio"; | |||||||
| void I2SAudioMediaPlayer::control(const media_player::MediaPlayerCall &call) { | void I2SAudioMediaPlayer::control(const media_player::MediaPlayerCall &call) { | ||||||
|   if (call.get_media_url().has_value()) { |   if (call.get_media_url().has_value()) { | ||||||
|     this->current_url_ = call.get_media_url(); |     this->current_url_ = call.get_media_url(); | ||||||
|  |     if (this->i2s_state_ != I2S_STATE_STOPPED && this->audio_ != nullptr) { | ||||||
|     if (this->state == media_player::MEDIA_PLAYER_STATE_PLAYING && this->audio_ != nullptr) { |  | ||||||
|       if (this->audio_->isRunning()) { |       if (this->audio_->isRunning()) { | ||||||
|         this->audio_->stopSong(); |         this->audio_->stopSong(); | ||||||
|       } |       } | ||||||
|       this->audio_->connecttohost(this->current_url_.value().c_str()); |       this->audio_->connecttohost(this->current_url_.value().c_str()); | ||||||
|  |       this->state = media_player::MEDIA_PLAYER_STATE_PLAYING; | ||||||
|     } else { |     } else { | ||||||
|       this->start(); |       this->start(); | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user