mirror of
https://gitee.com/openharmony/applications_settings
synced 2025-02-17 07:37:45 +00:00
Solve the problem that the volume is not automatically switched when the headset device is plugged in
Signed-off-by: fangzheng24 <fangzheng24@huawei.com>
This commit is contained in:
parent
aed5f8218b
commit
6fd1fc2413
@ -50,6 +50,18 @@ export async function registerObserver(){
|
||||
AppStorage.SetOrCreate('volume_media', data.volume);
|
||||
}
|
||||
})
|
||||
|
||||
audioManager.on('deviceChange', () => {
|
||||
audioManager.getVolume(Audio.AudioVolumeType.RINGTONE,(err,data)=>{
|
||||
AppStorage.SetOrCreate('volume_ringtone', data);
|
||||
})
|
||||
audioManager.getVolume(Audio.AudioVolumeType.VOICE_CALL,(err,data)=>{
|
||||
AppStorage.SetOrCreate('volume_voicecall', data);
|
||||
})
|
||||
audioManager.getVolume(Audio.AudioVolumeType.MEDIA,(err,data)=>{
|
||||
AppStorage.SetOrCreate('volume_media', data);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user