From 6b03f1ff47dd9c1d00be6c4f22c1192b859cb270 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Fri, 15 Apr 2022 09:41:13 -0400 Subject: [PATCH] QOL improvements to live stream If a user starts playing a recording while the live stream is already playing, the live stream volume will be set to 0 until the recording is finished playing. Prevents overlapping audio. Open to feedback/suggestions. Thanks! --- homepage/views.php | 15 +++++++++++++++ scripts/overview.php | 2 +- scripts/play.php | 2 +- scripts/stats.php | 4 ++-- scripts/todays_detections.php | 2 +- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/homepage/views.php b/homepage/views.php index 10a356a..6f18786 100644 --- a/homepage/views.php +++ b/homepage/views.php @@ -184,6 +184,21 @@ function myFunction() { x.className = "topnav"; } } +function setLiveStreamVolume(vol) { + var audioelement = window.parent.document.getElementsByTagName("audio")[0]; + if (typeof(audioelement) != 'undefined' && audioelement != null) + { + audioelement.volume = vol + } +} +window.onbeforeunload = function(event) { + // if the user is playing a video and then navigates away mid-play, the live stream audio should be unmuted again + var audioelement = window.parent.document.getElementsByTagName("audio")[0]; + if (typeof(audioelement) != 'undefined' && audioelement != null) + { + audioelement.volume = 1 + } +} diff --git a/scripts/overview.php b/scripts/overview.php index 49657af..00991ee 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -122,7 +122,7 @@ if (file_exists('./Charts/'.$chart)) {
Confidence:
- + diff --git a/scripts/play.php b/scripts/play.php index 8efb947..e9d385b 100644 --- a/scripts/play.php +++ b/scripts/play.php @@ -145,7 +145,7 @@ if(isset($_POST['species'])){ $confidence = $results['Confidence']; echo " $date $time
$confidence
- + "; }echo "";}?> diff --git a/scripts/stats.php b/scripts/stats.php index eaed49f..e2ff7fb 100644 --- a/scripts/stats.php +++ b/scripts/stats.php @@ -95,7 +95,7 @@ while($results=$result3->fetchArray(SQLITE3_ASSOC)){ Max Confidence: $maxconf
Best Recording: $date $time
All About Birds
- +

Loading Images from Wikimedia Commons

", '6096'); @@ -127,7 +127,7 @@ $filename = "/By_Date/".$results['Date']."/".$comname."/".$results['File_Name'];
Occurrences:
Max Confidence:
- Best Recording:
+ Best Recording:


Confidence:
- +