New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TTS to media browser #11679
Add TTS to media browser #11679
Conversation
: currentItem.children?.length | ||
? childrenMediaClass.layout === "grid" | ||
? html` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved the "no items" case up to get rid of a nested ternary statement.
@@ -186,10 +186,3 @@ export const updateCloudAlexaEntityConfig = ( | |||
entity_id: entityId, | |||
...values, | |||
}); | |||
|
|||
export interface CloudTTSInfo { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to a new cloud/tts.ts file
@@ -100,61 +103,9 @@ export class CloudTTSPref extends LitElement { | |||
} | |||
} | |||
|
|||
private getLanguages = memoizeOne((info?: CloudTTSInfo) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this to cloud/tts.ts
to make reusable.
@@ -219,18 +219,18 @@ class PanelMediaBrowser extends LitElement { | |||
return; | |||
} | |||
|
|||
if (item.media_content_type.startsWith("audio/")) { | |||
const resolvedUrl = await resolveMediaSource( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now always resolve the URL, because only the resolved URL can tell us correctly what content type it is. Noticed because TTS providers don't tell their mime type until you generate the file.
@@ -269,10 +269,6 @@ class PanelMediaBrowser extends LitElement { | |||
return [ | |||
haStyle, | |||
css` | |||
:host { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what this was doing besides messing up my button styling.
)} | ||
</button> | ||
` | ||
: html`<span></span>`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: html`<span></span>`} | |
: html``} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's on purpose to get flexbox to treat it as a child. Else the say button will jump from left to the right
Breaking change
Proposed change
Add TTS to media source. It shows a form to craft a message. Requires home-assistant/core#66483
For Home Assistant Cloud also shows the options:
When you change an option, it offers user also option to set the new combination as their default.
Once approved we can replace the cloud TTS try dialog with this implementation too.
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: