refactor to a high level audio handler

This commit is contained in:
Arjun Patel
2022-02-06 12:28:30 -08:00
parent 8ab20e7df8
commit 1b84b4324a
4 changed files with 269 additions and 237 deletions
@@ -62,6 +62,16 @@ export default function ConversationFullRow(props: {
});
};
const playLastClip = () => {
if (!props.conversation.cachedAudioClip) {
toast.error("Nothing to play");
return;
}
3;
const audio = new Audio(props.conversation.cachedAudioClip.audioDataUrl);
audio.play();
};
return (
<span
onClick={handleViewConversationDetails}
@@ -99,7 +109,13 @@ export default function ConversationFullRow(props: {
group-hover:visible invisible absolute right-5 text-slate-400"
>
<Tooltip title={"Play last convo chunk."}>
<span className="p-2 rounded-full hover:cursor-pointer hover:bg-slate-200">
<span
onClick={(e) => {
e.stopPropagation();
playLastClip();
}}
className="p-2 rounded-full hover:cursor-pointer hover:bg-slate-200"
>
<FaPlay className="ml-auto text-lg text-emerald-500" />
</span>
</Tooltip>