void AudioContext::startRendering() { if (ScriptController::processingUserGesture()) removeBehaviorRestriction(AudioContext::RequireUserGestureForAudioStartRestriction); if (pageConsentRequiredForAudioStart()) { Page* page = document()->page(); if (page && !page->canStartMedia()) document()->addMediaCanStartListener(this); else removeBehaviorRestriction(AudioContext::RequirePageConsentForAudioStartRestriction); } destination()->startRendering(); }
bool AudioContext::willPausePlayback() { if (userGestureRequiredForAudioStart()) { if (!ScriptController::processingUserGestureForMedia()) return false; removeBehaviorRestriction(AudioContext::RequireUserGestureForAudioStartRestriction); } if (pageConsentRequiredForAudioStart()) { Page* page = document()->page(); if (page && !page->canStartMedia()) { document()->addMediaCanStartListener(this); return false; } removeBehaviorRestriction(AudioContext::RequirePageConsentForAudioStartRestriction); } return m_mediaSession->clientWillPausePlayback(); }
void MediaElementSession::setWirelessVideoPlaybackDisabled(const HTMLMediaElement& element, bool disabled) { if (disabled) addBehaviorRestriction(WirelessVideoPlaybackDisabled); else removeBehaviorRestriction(WirelessVideoPlaybackDisabled); MediaPlayer* player = element.player(); if (!player) return; LOG(Media, "MediaElementSession::setWirelessVideoPlaybackDisabled - disabled %s", disabled ? "TRUE" : "FALSE"); player->setWirelessVideoPlaybackDisabled(disabled); }
void SpeechSynthesis::speak(SpeechSynthesisUtterance* utterance) { if (!utterance) return; // Like Audio, we should require that the user interact to start a speech synthesis session. #if PLATFORM(IOS) if (ScriptController::processingUserGesture()) removeBehaviorRestriction(RequireUserGestureForSpeechStartRestriction); else if (userGestureRequiredForSpeechStart()) return; #endif m_utteranceQueue.append(utterance); // If the queue was empty, speak this immediately and add it to the queue. if (m_utteranceQueue.size() == 1) startSpeakingImmediately(utterance); }
void AudioContext::mediaCanStart() { removeBehaviorRestriction(AudioContext::RequirePageConsentForAudioStartRestriction); }