mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 836201 - [FM Radio] Music is not playing while FM is playing in background. r=jlebar, a=leo+
This commit is contained in:
parent
8986e0f4c3
commit
7630cbfa40
@ -251,14 +251,23 @@ NS_IMETHODIMP FMRadio::CanPlayChanged(bool canPlay)
|
||||
nsCOMPtr<nsIAudioManager> audioManager =
|
||||
do_GetService(NS_AUDIOMANAGER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(audioManager, NS_OK);
|
||||
|
||||
bool AudioEnabled;
|
||||
audioManager->GetFmRadioAudioEnabled(&AudioEnabled);
|
||||
if (AudioEnabled == canPlay) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* mute fm first, it should be better to stop&resume fm */
|
||||
if (canPlay) {
|
||||
audioManager->SetFmRadioAudioEnabled(true);
|
||||
int32_t volIdx = 0;
|
||||
// Restore fm volume, that value is sync as music type
|
||||
audioManager->GetStreamVolumeIndex(nsIAudioManager::STREAM_TYPE_MUSIC, &volIdx);
|
||||
audioManager->SetStreamVolumeIndex(nsIAudioManager::STREAM_TYPE_FM, volIdx);
|
||||
} else {
|
||||
audioManager->SetStreamVolumeIndex(nsIAudioManager::STREAM_TYPE_FM, 0);
|
||||
audioManager->SetFmRadioAudioEnabled(false);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -42,10 +42,10 @@ public:
|
||||
private:
|
||||
~FMRadio();
|
||||
|
||||
nsCOMPtr<nsIAudioChannelAgent> mAudioChannelAgent;
|
||||
hal::SwitchState mHeadphoneState;
|
||||
bool mHasInternalAntenna;
|
||||
bool mHidden;
|
||||
nsCOMPtr<nsIAudioChannelAgent> mAudioChannelAgent;
|
||||
};
|
||||
|
||||
} // namespace fm
|
||||
|
Loading…
Reference in New Issue
Block a user