mirror of https://github.com/jetkvm/kvm.git
Fix: currently selected preset not coming from the API
This commit is contained in:
parent
2c2f2d416b
commit
e45bec4a9c
|
@ -93,23 +93,24 @@ func handleMicrophoneReset(c *gin.Context) {
|
||||||
|
|
||||||
// handleSubscribeAudioEvents handles WebSocket audio event subscription
|
// handleSubscribeAudioEvents handles WebSocket audio event subscription
|
||||||
func handleSubscribeAudioEvents(connectionID string, wsCon *websocket.Conn, runCtx context.Context, l *zerolog.Logger) {
|
func handleSubscribeAudioEvents(connectionID string, wsCon *websocket.Conn, runCtx context.Context, l *zerolog.Logger) {
|
||||||
l.Info().Msg("client subscribing to audio events")
|
initAudioControlService()
|
||||||
broadcaster := audio.GetAudioEventBroadcaster()
|
audioControlService.SubscribeToAudioEvents(connectionID, wsCon, runCtx, l)
|
||||||
broadcaster.Subscribe(connectionID, wsCon, runCtx, l)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleUnsubscribeAudioEvents handles WebSocket audio event unsubscription
|
// handleUnsubscribeAudioEvents handles WebSocket audio event unsubscription
|
||||||
func handleUnsubscribeAudioEvents(connectionID string, l *zerolog.Logger) {
|
func handleUnsubscribeAudioEvents(connectionID string, l *zerolog.Logger) {
|
||||||
l.Info().Msg("client unsubscribing from audio events")
|
initAudioControlService()
|
||||||
broadcaster := audio.GetAudioEventBroadcaster()
|
audioControlService.UnsubscribeFromAudioEvents(connectionID, l)
|
||||||
broadcaster.Unsubscribe(connectionID)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleAudioQuality handles GET requests for audio quality presets
|
// handleAudioQuality handles GET requests for audio quality presets
|
||||||
func handleAudioQuality(c *gin.Context) {
|
func handleAudioQuality(c *gin.Context) {
|
||||||
presets := audio.GetAudioQualityPresets()
|
initAudioControlService()
|
||||||
|
presets := audioControlService.GetAudioQualityPresets()
|
||||||
|
current := audioControlService.GetCurrentAudioQuality()
|
||||||
c.JSON(200, gin.H{
|
c.JSON(200, gin.H{
|
||||||
"presets": presets,
|
"presets": presets,
|
||||||
|
"current": current,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,9 +138,12 @@ func handleSetAudioQuality(c *gin.Context) {
|
||||||
|
|
||||||
// handleMicrophoneQuality handles GET requests for microphone quality presets
|
// handleMicrophoneQuality handles GET requests for microphone quality presets
|
||||||
func handleMicrophoneQuality(c *gin.Context) {
|
func handleMicrophoneQuality(c *gin.Context) {
|
||||||
presets := audio.GetMicrophoneQualityPresets()
|
initAudioControlService()
|
||||||
c.JSON(http.StatusOK, gin.H{
|
presets := audioControlService.GetMicrophoneQualityPresets()
|
||||||
|
current := audioControlService.GetCurrentMicrophoneQuality()
|
||||||
|
c.JSON(200, gin.H{
|
||||||
"presets": presets,
|
"presets": presets,
|
||||||
|
"current": current,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,16 @@ func (s *AudioControlService) GetMicrophoneQualityPresets() map[AudioQuality]Aud
|
||||||
return GetMicrophoneQualityPresets()
|
return GetMicrophoneQualityPresets()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetCurrentAudioQuality returns the current audio quality configuration
|
||||||
|
func (s *AudioControlService) GetCurrentAudioQuality() AudioConfig {
|
||||||
|
return GetAudioConfig()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCurrentMicrophoneQuality returns the current microphone quality configuration
|
||||||
|
func (s *AudioControlService) GetCurrentMicrophoneQuality() AudioConfig {
|
||||||
|
return GetMicrophoneConfig()
|
||||||
|
}
|
||||||
|
|
||||||
// SubscribeToAudioEvents subscribes to audio events via WebSocket
|
// SubscribeToAudioEvents subscribes to audio events via WebSocket
|
||||||
func (s *AudioControlService) SubscribeToAudioEvents(connectionID string, wsCon *websocket.Conn, runCtx context.Context, logger *zerolog.Logger) {
|
func (s *AudioControlService) SubscribeToAudioEvents(connectionID string, wsCon *websocket.Conn, runCtx context.Context, logger *zerolog.Logger) {
|
||||||
logger.Info().Msg("client subscribing to audio events")
|
logger.Info().Msg("client subscribing to audio events")
|
||||||
|
|
Loading…
Reference in New Issue