Ejemplo n.º 1
0
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();
}
Ejemplo n.º 2
0
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();
}
Ejemplo n.º 3
0
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);
}
Ejemplo n.º 4
0
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);
}
Ejemplo n.º 5
0
void AudioContext::mediaCanStart()
{
    removeBehaviorRestriction(AudioContext::RequirePageConsentForAudioStartRestriction);
}