@@ -480,6 +480,10 @@ - (BOOL)expectsRequestBodyFromMethod:(NSString *)method atPath:(NSString *)path
480
480
NSString * nowPlayingDetailsString = [NSString stringWithFormat: @" <br><br>frequency: %@ <br>modulation: %@ <br>sample rate: %@ <br><br>" , frequencyString, modulationString, sampleRateString];
481
481
482
482
[replacementDict setObject: nowPlayingDetailsString forKey: @" NOW_PLAYING_DETAILS" ];
483
+
484
+ NSString * openAudioPlayerPageButtonString = [self generateOpenAudioPlayerPageButtonString ];
485
+
486
+ [replacementDict setObject: openAudioPlayerPageButtonString forKey: @" OPEN_AUDIO_PLAYER_PAGE_BUTTON" ];
483
487
}
484
488
#pragma mark relativePath=nowplayingstatus.html
485
489
else if ([relativePath isEqualToString: @" /nowplayingstatus.html" ])
@@ -1744,33 +1748,44 @@ - (NSString *)generateMP3BitrateSelectString
1744
1748
}
1745
1749
1746
1750
NSMutableDictionary * bitrateDictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:
1747
- @" " , @" 3000" ,
1748
- @" " , @" 5000" ,
1749
- @" " , @" 7000" ,
1750
- @" " , @" 10000" ,
1751
- @" " , @" 12000" ,
1751
+ @" " , @" 8000" ,
1752
1752
@" " , @" 16000" ,
1753
1753
@" " , @" 24000" ,
1754
1754
@" " , @" 32000" ,
1755
1755
@" " , @" 48000" ,
1756
1756
@" " , @" 64000" ,
1757
+ @" " , @" 80000" ,
1758
+ @" " , @" 96000" ,
1759
+ @" " , @" 112000" ,
1757
1760
@" " , @" 128000" ,
1761
+ @" " , @" 160000" ,
1762
+ @" " , @" 192000" ,
1763
+ @" " , @" 224000" ,
1764
+ @" " , @" 256000" ,
1765
+ @" " , @" 320000" ,
1758
1766
NULL ];
1759
1767
1760
1768
[bitrateDictionary setObject: @" selected=\"\" " forKey: currentBitrate];
1761
1769
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" ]];
1774
1789
1775
1790
return resultString;
1776
1791
}
@@ -2100,7 +2115,7 @@ - (NSString *)generateAudioPlayerString:(BOOL)userAgentIsLocalRadioApp
2100
2115
@" onabort='audioPlayerAbort(this);' "
2101
2116
@" oncanplay='audioPlayerCanPlay(this);' "
2102
2117
@" oncanplaythrough='audioPlayerCanPlaythrough(this);' "
2103
- @" ondurationchange='audioPlayerCanPlaythrough (this);' "
2118
+ @" ondurationchange='audioPlayerDurationChange (this);' "
2104
2119
@" onemptied='audioPlayerEmptied(this);' "
2105
2120
@" onended='audioPlayerEnded(this);' "
2106
2121
@" onerror='audioPlayerError(this, error);' "
@@ -2117,7 +2132,7 @@ - (NSString *)generateAudioPlayerString:(BOOL)userAgentIsLocalRadioApp
2117
2132
@" onplay='audioPlayerStarted(this);' "
2118
2133
@" onsuspend='audioPlayerSuspend(this);' "
2119
2134
@" ontimeupdate='audioPlayerTimeUpdate(this);' "
2120
- @" ontimeupdate ='audioPlayerWaiting(this);' " ;
2135
+ @" onwaiting ='audioPlayerWaiting(this);' " ;
2121
2136
2122
2137
[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];
2123
2138
}
@@ -2161,7 +2176,12 @@ - (void)applyMP3Settings:(NSDictionary *)settingsDictionary
2161
2176
NSString * bitrate = [settingsDictionary objectForKey: @" bitrate" ];
2162
2177
NSString * encoding_quality = [settingsDictionary objectForKey: @" encoding_quality" ];
2163
2178
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];
2165
2185
2166
2186
[self performSelectorOnMainThread: @selector (setMP3SettingsTextField: ) withObject: mp3Setting waitUntilDone: YES ];
2167
2187
@@ -3558,4 +3578,27 @@ - (NSString *)generateCategorySelectOptions
3558
3578
return selectOptionsString;
3559
3579
}
3560
3580
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
+
3561
3604
@end
0 commit comments