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