On this page Key rules Use when / Avoid Live preview Standard Classic AI Mode Admin Do / Don't Accessibility Target Components
Voice player Điều khiển phát và transcript của tin nhắn thoại.
Copy page as Markdown Read Markdown ↗
Key rules
Kiểm tra nguồn trước khi truyền vào player.
Element chatty-voice-player ở mục Standard là chuẩn chatty-ui port theo; các mục theo surface mô tả component React đang chạy.
On this page Key rules Use when / Avoid Use instead Live preview Standard Element API Classic Import / element Anatomy Placement / order Props Sizes Tokens States Behaviour Copy Source AI Mode Import / element Anatomy Placement / order Props Sizes Tokens States Behaviour Copy Source Admin Import / element Anatomy Placement / order Props Sizes Tokens States Behaviour Copy Source Do / Don't Accessibility Target Use when / Avoid
Dùng cho tệp thoại trong luồng tin nhắn.
Use instead
Component
Use when
VoicePlayer
Phát audio đã được caller kiểm tra.
FileCard
Không phát được và cần hiển thị tệp dự phòng.
Live preview
Standard
Standard
Surface Classic AI Mode admin inbox Light Dark Desktop Mobile
Element chatty-voice-player chưa có src: độ dài tạm 0:42, control bị vô hiệu như preview React.
Show code chatty-voice-player.element.js Wrap code lines Copy <chatty-voice-player duration="42" download="voice-message.mp3" style="width: 320px">
<svg
slot="download-icon"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
aria-hidden="true"
>
<path d="M12 4v11m-5-5 5 5 5-5M5 20h14" />
</svg>
</chatty-voice-player>
Prototype (cùng voice-player.styles.js) là chuẩn: chatty-ui port 1:1, và chatty-ui/custom-elements.json sinh từ chính prototype. Nhãn đi qua property .strings; icon tải về đi qua slot. Chưa surface nào dùng element thật; các mục Classic, AI Mode và Admin bên dưới mô tả React đang chạy.
Element
Element
Module
chatty-voice-player
@avada/chatty-ui/elements/voice-player.js
API
Classic
Standard
Surface Classic Light Dark Desktop Mobile
Element chatty-voice-player chưa có src: độ dài tạm 0:42, control bị vô hiệu như preview React.
Show code chatty-voice-player.element.js Wrap code lines Copy <chatty-voice-player duration="42" download="voice-message.mp3" style="width: 320px">
<svg
slot="download-icon"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
aria-hidden="true"
>
<path d="M12 4v11m-5-5 5 5 5-5M5 20h14" />
</svg>
</chatty-voice-player>
Current (React), being replaced
Surface Classic Light Dark Desktop Mobile
Player thật chưa có nguồn audio; không gọi mạng.
Show code voice-player.jsx Wrap code lines Copy import React from 'react';
import {AppProvider, Button} from '@shopify/polaris';
import {VoicePlayer} from '@avada/chatty-ui/components';
const source = '';
// Stand-in for DownloadIcon: @shopify/polaris-icons is not in the guide lockfile.
const DownloadIcon = () => (
<svg viewBox="0 0 20 20" aria-hidden="true">
<path d="M10 3a.75.75 0 0 1 .75.75v7.19l2.22-2.22a.75.75 0 1 1 1.06 1.06l-3.5 3.5a.75.75 0 0 1-1.06 0l-3.5-3.5a.75.75 0 1 1 1.06-1.06l2.22 2.22V3.75A.75.75 0 0 1 10 3Zm-5.25 11.5a.75.75 0 0 1 .75.75v.25h9v-.25a.75.75 0 0 1 1.5 0v1a.75.75 0 0 1-.75.75H4.75a.75.75 0 0 1-.75-.75v-1a.75.75 0 0 1 .75-.75Z" />
</svg>
);
function StorefrontVoicePlayer() {
return (
<VoicePlayer
src={source}
durationSec={42}
downloadControl={false}
labels={{play: 'Play', pause: 'Pause', seek: 'Seek', speed: 'Playback speed'}}
/>
);
}
function AdminVoicePlayer() {
return (
<AppProvider i18n={{}}>
<VoicePlayer
src={source}
durationSec={42}
fileName="voice-message.mp3"
downloadControl={
<Button
icon={DownloadIcon}
variant="plain"
download="voice-message.mp3"
accessibilityLabel="Download voice message"
/>
}
labels={{
play: 'Play voice message',
pause: 'Pause voice message',
seek: 'Seek voice message',
download: 'Download voice message',
speed: 'Playback speed',
position: (current, duration) => `Played ${current} of ${duration}`
}}
/>
</AppProvider>
);
}
export function Catalogue({surface}) {
if (surface === 'admin') return <AdminVoicePlayer />;
return <StorefrontVoicePlayer />;
}
Import / element
Component / element
Import / file
Scope root
VoicePlayer
@avada/chatty-ui/components
.Avada-Faqs_Popup
Voice message audio
—
.Avada-Faqs_Popup
.Avada-Faq-VoiceMessage
—
.Avada-Faq-VoiceMessage
Anatomy
Part
Element
1
Audio ẩn và nút play.
2
Thanh seek, thời gian, tốc độ và download.
Placement / order
Context
Order
Voice player
Play, track, timing rồi download.
Props
Sizes
Tokens
Part
Token
Light
Dark
Foreground
--voice-player-foreground
Theo caller
Theo caller
Background
--voice-player-background
Theo caller
Theo caller
States
State
Trigger
Visual change (values)
ARIA/attribute
Không nguồn
src rỗng
Play và seek disabled.
Native disabled
Đang phát
playing
Icon và nhãn chuyển sang pause.
aria-label từ caller
Behaviour
Interaction
Result
Seek bằng phím
Trái hoặc phải tua 5 giây; Enter và Space đổi trạng thái phát.
Speed
Chuyển lần lượt giữa các tốc độ.
Không phát được
Hiện phản hồi lỗi hoặc trạng thái transcript của wrapper.
Copy
String
i18n key
Where
Play
Play
Nhãn play do wrapper truyền.
Pause
Pause
Nhãn pause do wrapper truyền.
Source
File
Evidence
Player API và hành vi
Layout và focus
Lazy import Classic
Caller Classic từ voice block Widget v2
Props và feedback Classic
Width và minimum height Classic
AI Mode
Standard
Surface AI Mode Light Dark Desktop Mobile
Element chatty-voice-player chưa có src: độ dài tạm 0:42, control bị vô hiệu như preview React.
Show code chatty-voice-player.element.js Wrap code lines Copy <chatty-voice-player duration="42" download="voice-message.mp3" style="width: 320px">
<svg
slot="download-icon"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
aria-hidden="true"
>
<path d="M12 4v11m-5-5 5 5 5-5M5 20h14" />
</svg>
</chatty-voice-player>
Current (React), being replaced
Surface AI Mode Light Dark Desktop Mobile
Player AI Mode thật, không có control tải xuống.
Show code voice-player.jsx Wrap code lines Copy import React from 'react';
import {AppProvider, Button} from '@shopify/polaris';
import {VoicePlayer} from '@avada/chatty-ui/components';
const source = '';
// Stand-in for DownloadIcon: @shopify/polaris-icons is not in the guide lockfile.
const DownloadIcon = () => (
<svg viewBox="0 0 20 20" aria-hidden="true">
<path d="M10 3a.75.75 0 0 1 .75.75v7.19l2.22-2.22a.75.75 0 1 1 1.06 1.06l-3.5 3.5a.75.75 0 0 1-1.06 0l-3.5-3.5a.75.75 0 1 1 1.06-1.06l2.22 2.22V3.75A.75.75 0 0 1 10 3Zm-5.25 11.5a.75.75 0 0 1 .75.75v.25h9v-.25a.75.75 0 0 1 1.5 0v1a.75.75 0 0 1-.75.75H4.75a.75.75 0 0 1-.75-.75v-1a.75.75 0 0 1 .75-.75Z" />
</svg>
);
function StorefrontVoicePlayer() {
return (
<VoicePlayer
src={source}
durationSec={42}
downloadControl={false}
labels={{play: 'Play', pause: 'Pause', seek: 'Seek', speed: 'Playback speed'}}
/>
);
}
function AdminVoicePlayer() {
return (
<AppProvider i18n={{}}>
<VoicePlayer
src={source}
durationSec={42}
fileName="voice-message.mp3"
downloadControl={
<Button
icon={DownloadIcon}
variant="plain"
download="voice-message.mp3"
accessibilityLabel="Download voice message"
/>
}
labels={{
play: 'Play voice message',
pause: 'Pause voice message',
seek: 'Seek voice message',
download: 'Download voice message',
speed: 'Playback speed',
position: (current, duration) => `Played ${current} of ${duration}`
}}
/>
</AppProvider>
);
}
export function Catalogue({surface}) {
if (surface === 'admin') return <AdminVoicePlayer />;
return <StorefrontVoicePlayer />;
}
Import / element
Component / element
Import / file
Scope root
VoicePlayer
@avada/chatty-ui/components
.chatty-ai-mode
Voice message bubble
—
.chatty-ai-mode
.chatty-voice-message
—
.chatty-voice-message
Anatomy
Part
Element
1
Audio ẩn và nút play.
2
Thanh seek, thời gian, tốc độ và download.
Placement / order
Context
Order
Voice player
Play, track, timing rồi download.
Props
Sizes
Tokens
Part
Token
Light
Dark
Foreground
--voice-player-foreground
var(--vib-1 )
var(--vib-1 )
Background
--voice-player-background
var(--surface-opaque )
var(--surface-opaque )
States
State
Trigger
Visual change (values)
ARIA/attribute
Không nguồn
URL không an toàn hoặc thiếu
Không render player; file thường là fallback khi có file.
Không đổi
Đang phát
playing
Icon và nhãn chuyển sang pause.
aria-label từ caller
Behaviour
Interaction
Result
Seek bằng phím
Trái hoặc phải tua 5 giây; Enter và Space đổi trạng thái phát.
Speed
Chuyển lần lượt giữa các tốc độ.
Copy
String
i18n key
Where
Play
Play
Nhãn play do caller truyền.
Pause
Pause
Nhãn pause do caller truyền.
Source
File
Evidence
Lazy import AI Mode
Caller, props và fallback AI Mode
Caller của attachment block
Player API và hành vi
Admin
Standard
Surface admin inbox Light Dark Desktop Mobile
Element chatty-voice-player chưa có src: độ dài tạm 0:42, control bị vô hiệu như preview React.
Show code chatty-voice-player.element.js Wrap code lines Copy <chatty-voice-player duration="42" download="voice-message.mp3" style="width: 320px">
<svg
slot="download-icon"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
aria-hidden="true"
>
<path d="M12 4v11m-5-5 5 5 5-5M5 20h14" />
</svg>
</chatty-voice-player>
Current (React), being replaced
Surface admin inbox Light Dark Desktop Mobile
Player Admin với nhãn và control tải xuống của inbox.
Show code voice-player.jsx Wrap code lines Copy import React from 'react';
import {AppProvider, Button} from '@shopify/polaris';
import {VoicePlayer} from '@avada/chatty-ui/components';
const source = '';
// Stand-in for DownloadIcon: @shopify/polaris-icons is not in the guide lockfile.
const DownloadIcon = () => (
<svg viewBox="0 0 20 20" aria-hidden="true">
<path d="M10 3a.75.75 0 0 1 .75.75v7.19l2.22-2.22a.75.75 0 1 1 1.06 1.06l-3.5 3.5a.75.75 0 0 1-1.06 0l-3.5-3.5a.75.75 0 1 1 1.06-1.06l2.22 2.22V3.75A.75.75 0 0 1 10 3Zm-5.25 11.5a.75.75 0 0 1 .75.75v.25h9v-.25a.75.75 0 0 1 1.5 0v1a.75.75 0 0 1-.75.75H4.75a.75.75 0 0 1-.75-.75v-1a.75.75 0 0 1 .75-.75Z" />
</svg>
);
function StorefrontVoicePlayer() {
return (
<VoicePlayer
src={source}
durationSec={42}
downloadControl={false}
labels={{play: 'Play', pause: 'Pause', seek: 'Seek', speed: 'Playback speed'}}
/>
);
}
function AdminVoicePlayer() {
return (
<AppProvider i18n={{}}>
<VoicePlayer
src={source}
durationSec={42}
fileName="voice-message.mp3"
downloadControl={
<Button
icon={DownloadIcon}
variant="plain"
download="voice-message.mp3"
accessibilityLabel="Download voice message"
/>
}
labels={{
play: 'Play voice message',
pause: 'Pause voice message',
seek: 'Seek voice message',
download: 'Download voice message',
speed: 'Playback speed',
position: (current, duration) => `Played ${current} of ${duration}`
}}
/>
</AppProvider>
);
}
export function Catalogue({surface}) {
if (surface === 'admin') return <AdminVoicePlayer />;
return <StorefrontVoicePlayer />;
}
Import / element
Component / element
Import / file
Scope root
VoicePlayer
@avada/chatty-ui/components
.inbox-v2
VoiceMessageAudio
@assets/pages/InboxManagement/v2 /blocks/VoiceMessageAudio.jsx
.inbox-v2
Anatomy
Part
Element
1
Audio ẩn và nút play.
2
Thanh seek, thời gian, tốc độ và download.
Placement / order
Context
Order
Voice player
Play, track, timing rồi download.
Props
Sizes
Tokens
Part
Token
Light
Dark
Foreground
--voice-player-foreground
Theo caller
No Dark skin
Background
--voice-player-background
Theo caller
No Dark skin
States
State
Trigger
Visual change (values)
ARIA/attribute
Không nguồn
src rỗng
Play và seek disabled.
Native disabled
Đang phát
playing
Icon và nhãn chuyển sang pause.
aria-label từ caller
Behaviour
Interaction
Result
Seek bằng phím
Trái hoặc phải tua 5 giây; Enter và Space đổi trạng thái phát.
Speed
Chuyển lần lượt giữa các tốc độ.
Không phát được
Wrapper có thể hiện file dự phòng.
Copy
String
i18n key
Where
Play voice message
Play voice message
Nhãn play do wrapper truyền.
Pause voice message
Pause voice message
Nhãn pause do wrapper truyền.
Source
File
Evidence
Player API và hành vi
Layout và focus
Kiểm tra nguồn và caller
Do / Don't
Accessibility
Target
Target — read the case before building
Surface
Now
Target
Source
Classic · AI Mode · Admin
VoicePlayer React
Not available — new build follows Target. Element (dự kiến): chatty-voice-player đọc attribute src, giữ trạng thái phát nội bộ, event play / pause.
MDN: Web Components
Classic · AI Mode · Admin
Component React theo surface
Not available — new build follows Target. Port chatty-voice-player từ mục Standard rồi chuyển caller từng surface.
Chatty UI · Chrome dùng chatty-ui theo palette light/dark của guide; specimen giữ surface riêng. Surface dùng native select để bốn nhãn vẫn vừa ở 390px.