nice improvements to the audio queue
This commit is contained in:
@@ -24,7 +24,7 @@ export default function AnnouncementCard(props: IAnnouncementCardProps) {
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
|
||||
function playAnnouncement() {
|
||||
handleAddAudioToQueue([props.announcement.audioDataUrl]);
|
||||
handleAddAudioToQueue([props.announcement.audioDataUrl], true);
|
||||
}
|
||||
|
||||
async function resolveAnnouncement() {
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function PowerPlayer(props: {
|
||||
// // loop through start to end and add to queue
|
||||
// var convoChunk: string[] = []
|
||||
|
||||
handleAddAudioToQueue([url]);
|
||||
handleAddAudioToQueue([url], true);
|
||||
}
|
||||
|
||||
function handleClose(e) {
|
||||
|
||||
@@ -548,8 +548,15 @@ export default function KeyboardContextProvider({ children }) {
|
||||
|
||||
const [playerSrc, setPlayerSrc] = useState<string>(null);
|
||||
|
||||
function handleAddAudioToQueue(urls: string[]) {
|
||||
setAudioQueue((prevQueue) => [...prevQueue, ...urls]);
|
||||
function handleAddAudioToQueue(
|
||||
urls: string[],
|
||||
clearEverythingElse: boolean = false
|
||||
) {
|
||||
if (clearEverythingElse) {
|
||||
setAudioQueue(urls);
|
||||
} else {
|
||||
setAudioQueue((prevQueue) => [...prevQueue, ...urls]);
|
||||
}
|
||||
}
|
||||
|
||||
function startAnnouncement() {
|
||||
|
||||
Reference in New Issue
Block a user