Skip to content

Commit 5ec1f8b

Browse files
author
dsward2
committed
In SDRController a checkIcecastAndEZStream method was added. It is called when a "Listen" button is tapped to check the status of the Icecast and EZStream servers. If one of those systems is not running, they will be restarted.
1 parent bccf24b commit 5ec1f8b

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

LocalRadio/SDRController.m

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ - (void)startTasksForDevice:(NSString *)deviceName
177177

178178
- (void)dispatchedStartRtlsdrTasksForFrequencies:(NSArray *)frequenciesArray category:(NSDictionary *)categoryDictionary device:(NSString *)audioInputDeviceName
179179
{
180+
// All of the "Listen" button actions eventually call this method
181+
182+
[self checkIcecastAndEZStream];
183+
180184
// Create TaskItem for the audio source, send lpcm data to stdout at specified sample rate
181185

182186
NSArray * audioOutputFilterStringArray = [self.audioOutputFilterString componentsSeparatedByString:@" "];
@@ -737,6 +741,30 @@ - (void)radioTaskReceivedStderrData:(NSNotification *)notif
737741
[fh waitForDataInBackgroundAndNotify];
738742
}
739743

744+
//==================================================================================
745+
// checkIcecastAndEZStream
746+
//==================================================================================
747+
748+
- (void)checkIcecastAndEZStream
749+
{
750+
BOOL restartServices = NO;
751+
752+
if (self.appDelegate.icecastController.icecastTask == NULL)
753+
{
754+
restartServices = YES;
755+
}
756+
757+
if (self.appDelegate.ezStreamController.ezStreamTaskPipelineManager.taskPipelineStatus != kTaskPipelineStatusRunning)
758+
{
759+
restartServices = YES;
760+
}
761+
762+
if (restartServices == YES)
763+
{
764+
[self.appDelegate restartServices];
765+
}
766+
}
767+
740768
//==================================================================================
741769
// retuneTaskForFrequency:
742770
//==================================================================================

LocalRadio/Web/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@
402402
{
403403
var holdAudioSrc = audioPlayer.src;
404404

405+
/*
405406
if (audioPlayer.paused == true)
406407
{
407408
updateSrcForAudioElement(audioPlayer);
@@ -410,6 +411,12 @@
410411
{
411412
seekToEndForAudioElement(audioPlayer);
412413
}
414+
*/
415+
416+
audioPlayer.pause();
417+
//seekToEndForAudioElement(audioPlayer);
418+
emptyBufferDataForAudioPlayer(audioPlayer);
419+
updateSrcForAudioElement(audioPlayer);
413420

414421
audioPlayer.autoplay=true;
415422
audioPlayer.load();

0 commit comments

Comments
 (0)