Browse Source

FIX: Stream audio in browser (#1872)

This fixes browsers like Safari and allows them to stream audio within
the browser vs downloading the audio.
Joey 9 years ago
parent
commit
f098f34141
1 changed files with 10 additions and 0 deletions
  1. 10 0
      themes/default/template.php

+ 10 - 0
themes/default/template.php

@@ -247,6 +247,16 @@
 				recording_audio.play();
 				document.getElementById('recording_button_'+recording_id).innerHTML = "<?php echo str_replace("class='list_control_icon'", "class='list_control_icon' style='opacity: 1;'", $v_link_label_pause); ?>";
 				audio_clock = setInterval(function () { update_progress(recording_id); }, 20);
+
+				$("[id*=recording_button]").not("[id*=recording_button_"+recording_id+"]").html("<?php echo $v_link_label_play; ?>");
+				$("[id*=recording_progress_bar]").not("[id*=recording_progress_bar_"+recording_id+"]").css('display', 'none');
+				
+				$('audio').each(function(){
+					if ($(this).get(0) != recording_audio) {
+					    $(this).get(0).pause(); // Stop playing
+					    $(this).get(0).currentTime = 0; // Reset time
+					}
+				});
 			}
 			else {
 				recording_audio.pause();