diff --git a/Chavah.NetCore/Controllers/CdnController.cs b/Chavah.NetCore/Controllers/CdnController.cs index 2b5654b..6147d54 100644 --- a/Chavah.NetCore/Controllers/CdnController.cs +++ b/Chavah.NetCore/Controllers/CdnController.cs @@ -83,10 +83,10 @@ public RedirectResult GetStationId() /// public RedirectResult GetAdAnnouncement() { - var sukkotAd = "sukkot2024.mp3"; + // var sukkotAd = "sukkot2024.mp3"; var ads = new[] { - sukkotAd, + // sukkotAd, "ad1x.mp3", "ad2x.mp3", "ad3x.mp3", @@ -96,9 +96,10 @@ public RedirectResult GetAdAnnouncement() }; // Sukkot 2024 ad: play it every even hour. - var fileName = DateTime.UtcNow.Hour % 2 == 0 ? sukkotAd : ads.RandomElement()!; + //var fileName = DateTime.UtcNow.Hour % 2 == 0 ? sukkotAd : ads.RandomElement()!; + var fileName = ads.RandomElement(); var directory = new Uri(cdnSettings.Value.HttpPath).Combine(cdnSettings.Value.SoundEffects); - return Redirect(directory.Combine(fileName).AbsoluteUri); + return Redirect(directory.Combine(fileName!).AbsoluteUri); } /// diff --git a/Chavah.NetCore/wwwroot/js/Controllers/HeaderController.ts b/Chavah.NetCore/wwwroot/js/Controllers/HeaderController.ts index e58cf39..fdcc251 100644 --- a/Chavah.NetCore/wwwroot/js/Controllers/HeaderController.ts +++ b/Chavah.NetCore/wwwroot/js/Controllers/HeaderController.ts @@ -90,7 +90,6 @@ // Tell the user if they have unread notifications after a bit. this.$timeout(() => { - console.log("zanz", this.notifications && this.notifications.filter(n => n.isUnread).length > 0); if (this.notifications && this.notifications.filter(n => n.isUnread).length > 0) { this.highlightUnreadNotifications = true; } diff --git a/Chavah.NetCore/wwwroot/js/Services/AdAnnouncerService.ts b/Chavah.NetCore/wwwroot/js/Services/AdAnnouncerService.ts index bf1535f..fa01897 100644 --- a/Chavah.NetCore/wwwroot/js/Services/AdAnnouncerService.ts +++ b/Chavah.NetCore/wwwroot/js/Services/AdAnnouncerService.ts @@ -32,8 +32,22 @@ } playAdAnnouncement() { - const songUrl = "/api/cdn/getAdAnnouncement"; - this.audioPlayer.playNewUri(songUrl); + const adUrl = "/api/cdn/getAdAnnouncement"; + + // Check if this is a redirect. If so, find the target of the redirect and play that. + // If not, play the URL. + // Reason is, on iOS we use native audio to play the URL. It can have issues playing a redirect result. + window.fetch(adUrl) + .then(res => { + const isRedirect = res.status >= 300 && res.status < 400; + if (isRedirect) { + const redirectUrl = res.headers.get("Location"); + this.audioPlayer.playNewUri(redirectUrl || adUrl); + } + }, err => { + console.warn("Unable to fetch ad announcement URL due to error", err); + this.audioPlayer.playNewUri(adUrl); + }); } } diff --git a/MessiahsMusicFundDisbursement.xlsx b/MessiahsMusicFundDisbursement.xlsx index 527489b..34f9edc 100644 Binary files a/MessiahsMusicFundDisbursement.xlsx and b/MessiahsMusicFundDisbursement.xlsx differ