I'm in Changsha, China. get my current location from Apple Maps. but the WeatherKit result is not same with Weather App.
request:
GET /api/v1/weather/zh-CN/28.212151/112.955606?countryCode=cn&timeZone=Asia%2FShanghai&dataSets=forecastHourly&hourlyStart=2022-12-12T22%3A19%3A05Z&hourlyEnd=2022-12-17T22%3A19%3A05Z
host: weatherkit.apple.com
response:
{
"forecastStart": "2022-12-17T22:00:00Z",
"cloudCover": 0.01,
"conditionCode": "Clear",
"daylight": false,
"humidity": 0.65,
"precipitationAmount": 0.0,
"precipitationIntensity": 0.0,
"precipitationChance": 0.0,
"precipitationType": "clear",
"pressure": 1036.48,
"pressureTrend": "falling",
"snowfallIntensity": 0.0,
"snowfallAmount": 0.0,
/// this is -2.83°C
"temperature": -2.83,
"temperatureApparent": -3.64,
"temperatureDewPoint": -8.47,
"uvIndex": 0,
"visibility": 18656.25,
"windDirection": 318,
"windGust": 9.61,
"windSpeed": 4.08
}
Weather App temperature is 2°C
Post
Replies
Boosts
Views
Activity
Hi, I need to do a function to convert the audio in the video into a sound animation. I use AVPlayer to play the video, but I don't find the spectrum data that the api can extract the audio. I know that AVAudioEngine can do this, but can AVPlayer be? Please give me a hint if you can, thank you./// AVAudioEngine can get amplitudes, but use AVPlayer how to get?
class AudioSpectrumPlayer {
private let engine = AVAudioEngine()
private let player = AVAudioPlayerNode()
private var fftSize: Int = 2048
init() {
engine.attach(player)
engine.connect(player, to: engine.mainMixerNode, format: nil)
engine.mainMixerNode.installTap(onBus: 0, bufferSize: AVAudioFrameCount(fftSize), format: nil, block: { [weak self](buffer, when) in
guard let strongSelf = self else { return }
if !strongSelf.player.isPlaying { return }
buffer.frameLength = AVAudioFrameCount(strongSelf.fftSize)
let amplitudes = strongSelf.fft(buffer)
/// get spectrum data at here
})
engine.prepare()
try! engine.start()
}
}