@@ -480,6 +480,10 @@ - (BOOL)expectsRequestBodyFromMethod:(NSString *)method atPath:(NSString *)path
480480 NSString * nowPlayingDetailsString = [NSString stringWithFormat: @" <br><br>frequency: %@ <br>modulation: %@ <br>sample rate: %@ <br><br>" , frequencyString, modulationString, sampleRateString];
481481
482482 [replacementDict setObject: nowPlayingDetailsString forKey: @" NOW_PLAYING_DETAILS" ];
483+
484+ NSString * openAudioPlayerPageButtonString = [self generateOpenAudioPlayerPageButtonString ];
485+
486+ [replacementDict setObject: openAudioPlayerPageButtonString forKey: @" OPEN_AUDIO_PLAYER_PAGE_BUTTON" ];
483487 }
484488 #pragma mark relativePath=nowplayingstatus.html
485489 else if ([relativePath isEqualToString: @" /nowplayingstatus.html" ])
@@ -1744,33 +1748,44 @@ - (NSString *)generateMP3BitrateSelectString
17441748 }
17451749
17461750 NSMutableDictionary * bitrateDictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:
1747- @" " , @" 3000" ,
1748- @" " , @" 5000" ,
1749- @" " , @" 7000" ,
1750- @" " , @" 10000" ,
1751- @" " , @" 12000" ,
1751+ @" " , @" 8000" ,
17521752 @" " , @" 16000" ,
17531753 @" " , @" 24000" ,
17541754 @" " , @" 32000" ,
17551755 @" " , @" 48000" ,
17561756 @" " , @" 64000" ,
1757+ @" " , @" 80000" ,
1758+ @" " , @" 96000" ,
1759+ @" " , @" 112000" ,
17571760 @" " , @" 128000" ,
1761+ @" " , @" 160000" ,
1762+ @" " , @" 192000" ,
1763+ @" " , @" 224000" ,
1764+ @" " , @" 256000" ,
1765+ @" " , @" 320000" ,
17581766 NULL ];
17591767
17601768 [bitrateDictionary setObject: @" selected=\"\" " forKey: currentBitrate];
17611769
1762-
1763- [resultString appendFormat: @" <option value=\" 3000\" %@ >Constant Bitrate 3000 bps</option>" , [bitrateDictionary objectForKey: @" 3000" ]];
1764- [resultString appendFormat: @" <option value=\" 5000\" %@ >Constant Bitrate 5000 bps</option>" , [bitrateDictionary objectForKey: @" 5000" ]];
1765- [resultString appendFormat: @" <option value=\" 7000\" %@ >Constant Bitrate 7000 bps</option>" , [bitrateDictionary objectForKey: @" 7000" ]];
1766- [resultString appendFormat: @" <option value=\" 10000\" %@ >Constant Bitrate 10000 bps</option>" , [bitrateDictionary objectForKey: @" 10000" ]];
1767- [resultString appendFormat: @" <option value=\" 12000\" %@ >Constant Bitrate 12000 bps</option>" , [bitrateDictionary objectForKey: @" 12000" ]];
1768- [resultString appendFormat: @" <option value=\" 16000\" %@ >Constant Bitrate 16000 bps</option>" , [bitrateDictionary objectForKey: @" 16000" ]];
1769- [resultString appendFormat: @" <option value=\" 24000\" %@ >Constant Bitrate 24000 bps</option>" , [bitrateDictionary objectForKey: @" 24000" ]];
1770- [resultString appendFormat: @" <option value=\" 32000\" %@ >Constant Bitrate 32000 bps</option>" , [bitrateDictionary objectForKey: @" 32000" ]];
1771- [resultString appendFormat: @" <option value=\" 48000\" %@ >Constant Bitrate 48000 bps</option>" , [bitrateDictionary objectForKey: @" 48000" ]];
1772- [resultString appendFormat: @" <option value=\" 64000\" %@ >Constant Bitrate 64000 bps</option>" , [bitrateDictionary objectForKey: @" 64000" ]];
1773- [resultString appendFormat: @" <option value=\" 128000\" %@ >Constant Bitrate 128000 bps</option>" , [bitrateDictionary objectForKey: @" 128000" ]];
1770+ // note from LAME:
1771+ // <bitrate> (bitrate in kbit/s) must be chosen from the following values: 8, 16, 24, 32, 40, 48, 64, 80, 96, 112, 128, 160, 192, 224, 256, or 320.
1772+
1773+ [resultString appendFormat: @" <option value=\" 8000\" %@ >8000 bps</option>" , [bitrateDictionary objectForKey: @" 8000" ]];
1774+ [resultString appendFormat: @" <option value=\" 16000\" %@ >16000 bps</option>" , [bitrateDictionary objectForKey: @" 16000" ]];
1775+ [resultString appendFormat: @" <option value=\" 24000\" %@ >24000 bps</option>" , [bitrateDictionary objectForKey: @" 24000" ]];
1776+ [resultString appendFormat: @" <option value=\" 32000\" %@ >32000 bps</option>" , [bitrateDictionary objectForKey: @" 32000" ]];
1777+ [resultString appendFormat: @" <option value=\" 40000\" %@ >40000 bps</option>" , [bitrateDictionary objectForKey: @" 40000" ]];
1778+ [resultString appendFormat: @" <option value=\" 48000\" %@ >48000 bps</option>" , [bitrateDictionary objectForKey: @" 48000" ]];
1779+ [resultString appendFormat: @" <option value=\" 64000\" %@ >64000 bps</option>" , [bitrateDictionary objectForKey: @" 64000" ]];
1780+ [resultString appendFormat: @" <option value=\" 80000\" %@ >80000 bps</option>" , [bitrateDictionary objectForKey: @" 80000" ]];
1781+ [resultString appendFormat: @" <option value=\" 96000\" %@ >96000 bps</option>" , [bitrateDictionary objectForKey: @" 96000" ]];
1782+ [resultString appendFormat: @" <option value=\" 112000\" %@ >112000 bps</option>" , [bitrateDictionary objectForKey: @" 112000" ]];
1783+ [resultString appendFormat: @" <option value=\" 128000\" %@ >128000 bps</option>" , [bitrateDictionary objectForKey: @" 128000" ]];
1784+ [resultString appendFormat: @" <option value=\" 160000\" %@ >160000 bps</option>" , [bitrateDictionary objectForKey: @" 160000" ]];
1785+ [resultString appendFormat: @" <option value=\" 192000\" %@ >192000 bps</option>" , [bitrateDictionary objectForKey: @" 192000" ]];
1786+ [resultString appendFormat: @" <option value=\" 224000\" %@ >224000 bps</option>" , [bitrateDictionary objectForKey: @" 224000" ]];
1787+ [resultString appendFormat: @" <option value=\" 256000\" %@ >256000 bps</option>" , [bitrateDictionary objectForKey: @" 256000" ]];
1788+ [resultString appendFormat: @" <option value=\" 320000\" %@ >320000 bps</option>" , [bitrateDictionary objectForKey: @" 320000" ]];
17741789
17751790 return resultString;
17761791}
@@ -2100,7 +2115,7 @@ - (NSString *)generateAudioPlayerString:(BOOL)userAgentIsLocalRadioApp
21002115 @" onabort='audioPlayerAbort(this);' "
21012116 @" oncanplay='audioPlayerCanPlay(this);' "
21022117 @" oncanplaythrough='audioPlayerCanPlaythrough(this);' "
2103- @" ondurationchange='audioPlayerCanPlaythrough (this);' "
2118+ @" ondurationchange='audioPlayerDurationChange (this);' "
21042119 @" onemptied='audioPlayerEmptied(this);' "
21052120 @" onended='audioPlayerEnded(this);' "
21062121 @" onerror='audioPlayerError(this, error);' "
@@ -2117,7 +2132,7 @@ - (NSString *)generateAudioPlayerString:(BOOL)userAgentIsLocalRadioApp
21172132 @" onplay='audioPlayerStarted(this);' "
21182133 @" onsuspend='audioPlayerSuspend(this);' "
21192134 @" ontimeupdate='audioPlayerTimeUpdate(this);' "
2120- @" ontimeupdate ='audioPlayerWaiting(this);' " ;
2135+ @" onwaiting ='audioPlayerWaiting(this);' " ;
21212136
21222137 [resultString appendFormat: @" <audio id='audio_element' controls %@ preload=\" none\" src='%@ ' type='audio/mpeg' %@ title='LocalRadio audio player.'>Your browser does not support the audio element.</audio>\n " , autoplayFlag, mp3URLString, audioPlayerJS];
21232138 }
@@ -2161,7 +2176,12 @@ - (void)applyMP3Settings:(NSDictionary *)settingsDictionary
21612176 NSString * bitrate = [settingsDictionary objectForKey: @" bitrate" ];
21622177 NSString * encoding_quality = [settingsDictionary objectForKey: @" encoding_quality" ];
21632178
2164- NSString * mp3Setting = [NSString stringWithFormat: @" %@ .%@ " , bitrate, encoding_quality];
2179+ NSInteger bitrateInt = bitrate.integerValue ;
2180+
2181+ NSInteger bitrateK = bitrateInt / 1000 ;
2182+
2183+ // NSString * mp3Setting = [NSString stringWithFormat:@"%@.%@", bitrate, encoding_quality];
2184+ NSString * mp3Setting = [NSString stringWithFormat: @" %ld .%@ " , bitrateK, encoding_quality];
21652185
21662186 [self performSelectorOnMainThread: @selector (setMP3SettingsTextField: ) withObject: mp3Setting waitUntilDone: YES ];
21672187
@@ -3558,4 +3578,27 @@ - (NSString *)generateCategorySelectOptions
35583578 return selectOptionsString;
35593579}
35603580
3581+
3582+ // ==================================================================================
3583+ // generateOpenAudioPlayerPageButtonString
3584+ // ==================================================================================
3585+
3586+ - (NSString *)generateOpenAudioPlayerPageButtonString
3587+ {
3588+ NSString * hostString = self.appDelegate .localHostString ;
3589+
3590+ NSNumber * icecastServerPortNumber = [self .appDelegate.localRadioAppSettings integerForKey: @" IcecastServerPort" ];
3591+ NSString * icecastServerMountName = [self .appDelegate.localRadioAppSettings valueForKey: @" IcecastServerMountName" ];
3592+
3593+ // NSString * audioURLString = [NSString stringWithFormat:@"window.location='http://%@:%@/%@'", hostString, icecastServerPortNumber, icecastServerMountName];
3594+ // NSString * audioURLString = [NSString stringWithFormat:@"location.href='http://%@:%@/%@'", hostString, icecastServerPortNumber, icecastServerMountName];
3595+ NSString * audioURLString = [NSString stringWithFormat: @" http://%@ :%@ /%@ " , hostString, icecastServerPortNumber, icecastServerMountName];
3596+
3597+ // NSString * listenButtonString = [NSString stringWithFormat:@"<button class='button button-primary twelve columns' type='button' onclick=\"%@\" target='_parent'>Open Audio Player Page</button>", audioURLString];
3598+
3599+ NSString * listenButtonString = [NSString stringWithFormat: @" <a href='%@ ' target='_top'><button class='button button-primary twelve columns' type='button'>Open Audio Player Page</button></a>" , audioURLString];
3600+
3601+ return listenButtonString;
3602+ }
3603+
35613604@end
0 commit comments