Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Fix audio player conflicts when opening modals with audio

Murtaza Nasir695495004e5c
diff --git a/static/js/modules/composables/speakers.js b/static/js/modules/composables/speakers.js
index 6cfe4d88..6b713cfd 100644
--- a/static/js/modules/composables/speakers.js
+++ b/static/js/modules/composables/speakers.js
@@ -24,6 +24,16 @@ export function useSpeakers(state, utils, processedTranscription) {
// Current speaker highlight state
let currentSpeakerId = null;
+ // Helper to pause outer audio player when opening modals with their own player
+ const pauseOuterAudioPlayer = () => {
+ // Find the audio player in the right panel (not in a modal)
+ const outerAudio = document.querySelector('#rightMainColumn audio') ||
+ document.querySelector('.detail-view audio:not(.fixed audio)');
+ if (outerAudio && !outerAudio.paused) {
+ outerAudio.pause();
+ }
+ };
+
// =========================================
// Speaker Identification Modal
// =========================================
@@ -31,6 +41,9 @@ export function useSpeakers(state, utils, processedTranscription) {
const openSpeakerModal = () => {
if (!selectedRecording.value) return;
+ // Pause outer audio player to avoid conflicts with modal's player
+ pauseOuterAudioPlayer();
+
// Clear any existing speaker map data first
speakerMap.value = {};
speakerDisplayMap.value = {};
diff --git a/static/js/modules/composables/transcription.js b/static/js/modules/composables/transcription.js
index 80648315..697cccc5 100644
--- a/static/js/modules/composables/transcription.js
+++ b/static/js/modules/composables/transcription.js
@@ -56,8 +56,21 @@ export function useTranscription(state, utils) {
// ASR Editor Modal
// =========================================
+ // Helper to pause outer audio player when opening modals with their own player
+ const pauseOuterAudioPlayer = () => {
+ const outerAudio = document.querySelector('#rightMainColumn audio') ||
+ document.querySelector('.detail-view audio:not(.fixed audio)');
+ if (outerAudio && !outerAudio.paused) {
+ outerAudio.pause();
+ }
+ };
+
const openAsrEditorModal = async () => {
if (!selectedRecording.value) return;
+
+ // Pause outer audio player to avoid conflicts with modal's player
+ pauseOuterAudioPlayer();
+
try {
const segments = JSON.parse(selectedRecording.value.transcription);