void AudioChannelAgent::NotifyAudioChannelStateChanged() { if (mCallback != nullptr) { AudioChannelService *service = AudioChannelService::GetAudioChannelService(); mCallback->CanPlayChanged(!service->GetMuted(this, !mVisible)); } }
/* void setVisibilityState (in boolean visible); */ NS_IMETHODIMP AudioChannelAgent::SetVisibilityState(bool visible) { bool oldVisibility = mVisible; mVisible = visible; if (mIsRegToService && oldVisibility != mVisible && mCallback != nullptr) { AudioChannelService *service = AudioChannelService::GetAudioChannelService(); mCallback->CanPlayChanged(!service->GetMuted(this, !mVisible)); } return NS_OK; }
/* boolean startPlaying (); */ NS_IMETHODIMP AudioChannelAgent::StartPlaying(bool *_retval) { AudioChannelService *service = AudioChannelService::GetAudioChannelService(); if (mAudioChannelType == AUDIO_AGENT_CHANNEL_ERROR || service == nullptr) { return NS_ERROR_FAILURE; } service->RegisterAudioChannelAgent(this, static_cast<AudioChannelType>(mAudioChannelType)); *_retval = !service->GetMuted(this, !mVisible); mIsRegToService = true; return NS_OK; }