[iOS] When Web Audio is interrupted by a phone call, it cannot be restarted.
https://bugs.webkit.org/show_bug.cgi?id=143190
Reviewed by Darin Adler.
Source/WebCore:
Tests: webaudio/audiocontext-state-interrupted.html
webaudio/audiocontext-state.html
Implement the following methods and properties from the Web Audio spec:
close(), suspend(), resume(), onstatechange.
AudioContext will take more responsibility for tracking state and interruptions (and
AudioDestination will give up that responsibility). This means AudioContext must be a
MediaSessionClient, and own its own MediaSession. In return, AudioDestinationIOS and
AudioDestinationMac relinquish both.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::AudioContext): Set default values in header.
(WebCore::AudioContext::uninitialize): Call setState() instead of setting m_state.
(WebCore::AudioContext::addReaction): Added. Append the callback to the appropriate vector for the state.
(WebCore::AudioContext::setState): Added. Fire events and resolve the appropriate reaction callbacks for the new state.
(WebCore::AudioContext::state): Return a string representing the context's state.
(WebCore::AudioContext::stop): Close the event queue.
(WebCore::AudioContext::startRendering): Call setState().
(WebCore::AudioContext::fireCompletionEvent): Call setState().
(WebCore::AudioContext::suspendContext): Added. Add reaction callback and call suspend() on the destination node.
(WebCore::AudioContext::resumeContext): Added. Add reaction callback and call resume() on the destination node.
(WebCore::AudioContext::closeContext): Added. Add reaction callback and call close() on the destination node.
(WebCore::AudioContext::suspendPlayback): Added. Suspend playback and set state to interrupted.
(WebCore::AudioContext::mayResumePlayback): Added. Conditionally resume playback.
* bindings/js/JSAudioContextCustom.cpp:
(WebCore::JSAudioContext::suspend): Added. Create and return a new Promise object.
(WebCore::JSAudioContext::resume): Ditto.
(WebCore::JSAudioContext::close): Ditto.
* Modules/webaudio/AudioContext.idl: Add new methods and properties.
Extensive organizational changes were made to AudioContext.h to group instance
variables together and add C++11 initializers in their declarations:
* Modules/webaudio/AudioContext.h:
(WebCore::AudioContext::mediaType): Moved from AudioDestinationNode.
(WebCore::AudioContext::presentationType): Ditto.
(WebCore::AudioContext::canReceiveRemoteControlCommands): Ditto.
(WebCore::AudioContext::didReceiveRemoteControlCommand): Ditto.
(WebCore::AudioContext::overrideBackgroundPlaybackRestriction): Ditto.
Other changes to support the new AudioContext methods:
* Modules/webaudio/AudioDestinationNode.h:
(WebCore::AudioDestinationNode::resume): Add empty default virtual method.
(WebCore::AudioDestinationNode::suspend): Ditto.
(WebCore::AudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.cpp:
(WebCore::DefaultAudioDestinationNode::resume): Added. Pass to AudioDestination.
(WebCore::DefaultAudioDestinationNode::suspend): Ditto.
(WebCore::DefaultAudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.h:
* bindings/js/JSDOMPromise.h:
(WebCore::DeferredWrapper::resolve): Add an overload for a nullptr resolve value.
* dom/EventNames.h: Added 'statechange'.
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::Task::Task): Add a constructor which takes a void() callback.
Modify MediaSession, AudioSession, and MediaSessionManager to support the new
interruption behavior.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::suspendPlayback): Renamed from pausePlayback().
(WebCore::HTMLMediaElement::mayResumePlayback): Renamed from resumePlayback().
* html/HTMLMediaElement.h:
* platform/audio/AudioSession.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/AudioSession.h:
* platform/audio/MediaSession.cpp:
(WebCore::MediaSession::beginInterruption): pausePlayback() was renamed to suspendPlayback().
(WebCore::MediaSession::endInterruption): Always notify the client, telling it whether to resume.
(WebCore::MediaSession::clientWillBeginPlayback): Bail early if reentrant. Check the (new)
return value of sessionWillBeginPlayback() and remember to resume once the interruption ends.
(WebCore::MediaSession::clientWillPausePlayback): Bail early if reentrant.
(WebCore::MediaSession::pauseSession): pausePlayback() was renamed to suspendPlayback().
* platform/audio/MediaSession.h:
* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::sessionWillBeginPlayback): Return false if not allowed to break interruption or
if activating the audio session failed. Otherwise, end the interruption.
* platform/audio/MediaSessionManager.h:
* platform/audio/ios/AudioDestinationIOS.cpp:
(WebCore::AudioDestinationIOS::AudioDestinationIOS): m_mediaSession was removed.
(WebCore::AudioDestinationIOS::start): Ditto.
* platform/audio/ios/AudioDestinationIOS.h:
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return false if the AVAudioSession could not be activated.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): Do not update the now playing info if session playback was blocked.
* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestinationMac::AudioDestinationMac): m_mediaSession was removed.
* platform/audio/mac/AudioDestinationMac.h:
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive(). Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/mac/MediaSessionManagerMac.cpp:
(MediaSessionManager::updateSessionState): No longer attempt to activate the session, as this is done
MediaSessionManager::sessionWillBeginPlayback().
* testing/Internals.cpp:
(WebCore::Internals::setMediaSessionRestrictions): Add "InterruptedPlaybackNotPermitted".
LayoutTests:
* webaudio/audiocontext-state-expected.txt: Added.
* webaudio/audiocontext-state-interrupted-expected.txt: Added.
* webaudio/audiocontext-state-interrupted.html: Added.
* webaudio/audiocontext-state.html: Added.
Canonical link: https://commits.webkit.org/161241@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-30 16:15:00 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
|
|
|
|
<html>
|
|
|
|
<head>
|
2017-05-22 20:49:12 +00:00
|
|
|
<script src="../resources/js-test.js"></script>
|
[iOS] When Web Audio is interrupted by a phone call, it cannot be restarted.
https://bugs.webkit.org/show_bug.cgi?id=143190
Reviewed by Darin Adler.
Source/WebCore:
Tests: webaudio/audiocontext-state-interrupted.html
webaudio/audiocontext-state.html
Implement the following methods and properties from the Web Audio spec:
close(), suspend(), resume(), onstatechange.
AudioContext will take more responsibility for tracking state and interruptions (and
AudioDestination will give up that responsibility). This means AudioContext must be a
MediaSessionClient, and own its own MediaSession. In return, AudioDestinationIOS and
AudioDestinationMac relinquish both.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::AudioContext): Set default values in header.
(WebCore::AudioContext::uninitialize): Call setState() instead of setting m_state.
(WebCore::AudioContext::addReaction): Added. Append the callback to the appropriate vector for the state.
(WebCore::AudioContext::setState): Added. Fire events and resolve the appropriate reaction callbacks for the new state.
(WebCore::AudioContext::state): Return a string representing the context's state.
(WebCore::AudioContext::stop): Close the event queue.
(WebCore::AudioContext::startRendering): Call setState().
(WebCore::AudioContext::fireCompletionEvent): Call setState().
(WebCore::AudioContext::suspendContext): Added. Add reaction callback and call suspend() on the destination node.
(WebCore::AudioContext::resumeContext): Added. Add reaction callback and call resume() on the destination node.
(WebCore::AudioContext::closeContext): Added. Add reaction callback and call close() on the destination node.
(WebCore::AudioContext::suspendPlayback): Added. Suspend playback and set state to interrupted.
(WebCore::AudioContext::mayResumePlayback): Added. Conditionally resume playback.
* bindings/js/JSAudioContextCustom.cpp:
(WebCore::JSAudioContext::suspend): Added. Create and return a new Promise object.
(WebCore::JSAudioContext::resume): Ditto.
(WebCore::JSAudioContext::close): Ditto.
* Modules/webaudio/AudioContext.idl: Add new methods and properties.
Extensive organizational changes were made to AudioContext.h to group instance
variables together and add C++11 initializers in their declarations:
* Modules/webaudio/AudioContext.h:
(WebCore::AudioContext::mediaType): Moved from AudioDestinationNode.
(WebCore::AudioContext::presentationType): Ditto.
(WebCore::AudioContext::canReceiveRemoteControlCommands): Ditto.
(WebCore::AudioContext::didReceiveRemoteControlCommand): Ditto.
(WebCore::AudioContext::overrideBackgroundPlaybackRestriction): Ditto.
Other changes to support the new AudioContext methods:
* Modules/webaudio/AudioDestinationNode.h:
(WebCore::AudioDestinationNode::resume): Add empty default virtual method.
(WebCore::AudioDestinationNode::suspend): Ditto.
(WebCore::AudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.cpp:
(WebCore::DefaultAudioDestinationNode::resume): Added. Pass to AudioDestination.
(WebCore::DefaultAudioDestinationNode::suspend): Ditto.
(WebCore::DefaultAudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.h:
* bindings/js/JSDOMPromise.h:
(WebCore::DeferredWrapper::resolve): Add an overload for a nullptr resolve value.
* dom/EventNames.h: Added 'statechange'.
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::Task::Task): Add a constructor which takes a void() callback.
Modify MediaSession, AudioSession, and MediaSessionManager to support the new
interruption behavior.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::suspendPlayback): Renamed from pausePlayback().
(WebCore::HTMLMediaElement::mayResumePlayback): Renamed from resumePlayback().
* html/HTMLMediaElement.h:
* platform/audio/AudioSession.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/AudioSession.h:
* platform/audio/MediaSession.cpp:
(WebCore::MediaSession::beginInterruption): pausePlayback() was renamed to suspendPlayback().
(WebCore::MediaSession::endInterruption): Always notify the client, telling it whether to resume.
(WebCore::MediaSession::clientWillBeginPlayback): Bail early if reentrant. Check the (new)
return value of sessionWillBeginPlayback() and remember to resume once the interruption ends.
(WebCore::MediaSession::clientWillPausePlayback): Bail early if reentrant.
(WebCore::MediaSession::pauseSession): pausePlayback() was renamed to suspendPlayback().
* platform/audio/MediaSession.h:
* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::sessionWillBeginPlayback): Return false if not allowed to break interruption or
if activating the audio session failed. Otherwise, end the interruption.
* platform/audio/MediaSessionManager.h:
* platform/audio/ios/AudioDestinationIOS.cpp:
(WebCore::AudioDestinationIOS::AudioDestinationIOS): m_mediaSession was removed.
(WebCore::AudioDestinationIOS::start): Ditto.
* platform/audio/ios/AudioDestinationIOS.h:
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return false if the AVAudioSession could not be activated.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): Do not update the now playing info if session playback was blocked.
* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestinationMac::AudioDestinationMac): m_mediaSession was removed.
* platform/audio/mac/AudioDestinationMac.h:
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive(). Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/mac/MediaSessionManagerMac.cpp:
(MediaSessionManager::updateSessionState): No longer attempt to activate the session, as this is done
MediaSessionManager::sessionWillBeginPlayback().
* testing/Internals.cpp:
(WebCore::Internals::setMediaSessionRestrictions): Add "InterruptedPlaybackNotPermitted".
LayoutTests:
* webaudio/audiocontext-state-expected.txt: Added.
* webaudio/audiocontext-state-interrupted-expected.txt: Added.
* webaudio/audiocontext-state-interrupted.html: Added.
* webaudio/audiocontext-state.html: Added.
Canonical link: https://commits.webkit.org/161241@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-30 16:15:00 +00:00
|
|
|
<script type="text/javascript" src="resources/audio-testing.js"></script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<div id="description"></div>
|
|
|
|
<div id="console"></div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
description('Basic tests for AudioNode API.');
|
|
|
|
|
|
|
|
var context = null;
|
|
|
|
var node = null;
|
|
|
|
|
2020-10-27 21:46:21 +00:00
|
|
|
function onAudioContextAutoStart()
|
|
|
|
{
|
|
|
|
context.onstatechange = null;
|
|
|
|
shouldBeEqualToString('context.state', 'running');
|
|
|
|
|
|
|
|
debug('Calling context.suspend()');
|
|
|
|
context.suspend().then(suspendSucceeded, suspendFailed);
|
|
|
|
}
|
|
|
|
|
[iOS] When Web Audio is interrupted by a phone call, it cannot be restarted.
https://bugs.webkit.org/show_bug.cgi?id=143190
Reviewed by Darin Adler.
Source/WebCore:
Tests: webaudio/audiocontext-state-interrupted.html
webaudio/audiocontext-state.html
Implement the following methods and properties from the Web Audio spec:
close(), suspend(), resume(), onstatechange.
AudioContext will take more responsibility for tracking state and interruptions (and
AudioDestination will give up that responsibility). This means AudioContext must be a
MediaSessionClient, and own its own MediaSession. In return, AudioDestinationIOS and
AudioDestinationMac relinquish both.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::AudioContext): Set default values in header.
(WebCore::AudioContext::uninitialize): Call setState() instead of setting m_state.
(WebCore::AudioContext::addReaction): Added. Append the callback to the appropriate vector for the state.
(WebCore::AudioContext::setState): Added. Fire events and resolve the appropriate reaction callbacks for the new state.
(WebCore::AudioContext::state): Return a string representing the context's state.
(WebCore::AudioContext::stop): Close the event queue.
(WebCore::AudioContext::startRendering): Call setState().
(WebCore::AudioContext::fireCompletionEvent): Call setState().
(WebCore::AudioContext::suspendContext): Added. Add reaction callback and call suspend() on the destination node.
(WebCore::AudioContext::resumeContext): Added. Add reaction callback and call resume() on the destination node.
(WebCore::AudioContext::closeContext): Added. Add reaction callback and call close() on the destination node.
(WebCore::AudioContext::suspendPlayback): Added. Suspend playback and set state to interrupted.
(WebCore::AudioContext::mayResumePlayback): Added. Conditionally resume playback.
* bindings/js/JSAudioContextCustom.cpp:
(WebCore::JSAudioContext::suspend): Added. Create and return a new Promise object.
(WebCore::JSAudioContext::resume): Ditto.
(WebCore::JSAudioContext::close): Ditto.
* Modules/webaudio/AudioContext.idl: Add new methods and properties.
Extensive organizational changes were made to AudioContext.h to group instance
variables together and add C++11 initializers in their declarations:
* Modules/webaudio/AudioContext.h:
(WebCore::AudioContext::mediaType): Moved from AudioDestinationNode.
(WebCore::AudioContext::presentationType): Ditto.
(WebCore::AudioContext::canReceiveRemoteControlCommands): Ditto.
(WebCore::AudioContext::didReceiveRemoteControlCommand): Ditto.
(WebCore::AudioContext::overrideBackgroundPlaybackRestriction): Ditto.
Other changes to support the new AudioContext methods:
* Modules/webaudio/AudioDestinationNode.h:
(WebCore::AudioDestinationNode::resume): Add empty default virtual method.
(WebCore::AudioDestinationNode::suspend): Ditto.
(WebCore::AudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.cpp:
(WebCore::DefaultAudioDestinationNode::resume): Added. Pass to AudioDestination.
(WebCore::DefaultAudioDestinationNode::suspend): Ditto.
(WebCore::DefaultAudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.h:
* bindings/js/JSDOMPromise.h:
(WebCore::DeferredWrapper::resolve): Add an overload for a nullptr resolve value.
* dom/EventNames.h: Added 'statechange'.
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::Task::Task): Add a constructor which takes a void() callback.
Modify MediaSession, AudioSession, and MediaSessionManager to support the new
interruption behavior.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::suspendPlayback): Renamed from pausePlayback().
(WebCore::HTMLMediaElement::mayResumePlayback): Renamed from resumePlayback().
* html/HTMLMediaElement.h:
* platform/audio/AudioSession.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/AudioSession.h:
* platform/audio/MediaSession.cpp:
(WebCore::MediaSession::beginInterruption): pausePlayback() was renamed to suspendPlayback().
(WebCore::MediaSession::endInterruption): Always notify the client, telling it whether to resume.
(WebCore::MediaSession::clientWillBeginPlayback): Bail early if reentrant. Check the (new)
return value of sessionWillBeginPlayback() and remember to resume once the interruption ends.
(WebCore::MediaSession::clientWillPausePlayback): Bail early if reentrant.
(WebCore::MediaSession::pauseSession): pausePlayback() was renamed to suspendPlayback().
* platform/audio/MediaSession.h:
* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::sessionWillBeginPlayback): Return false if not allowed to break interruption or
if activating the audio session failed. Otherwise, end the interruption.
* platform/audio/MediaSessionManager.h:
* platform/audio/ios/AudioDestinationIOS.cpp:
(WebCore::AudioDestinationIOS::AudioDestinationIOS): m_mediaSession was removed.
(WebCore::AudioDestinationIOS::start): Ditto.
* platform/audio/ios/AudioDestinationIOS.h:
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return false if the AVAudioSession could not be activated.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): Do not update the now playing info if session playback was blocked.
* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestinationMac::AudioDestinationMac): m_mediaSession was removed.
* platform/audio/mac/AudioDestinationMac.h:
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive(). Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/mac/MediaSessionManagerMac.cpp:
(MediaSessionManager::updateSessionState): No longer attempt to activate the session, as this is done
MediaSessionManager::sessionWillBeginPlayback().
* testing/Internals.cpp:
(WebCore::Internals::setMediaSessionRestrictions): Add "InterruptedPlaybackNotPermitted".
LayoutTests:
* webaudio/audiocontext-state-expected.txt: Added.
* webaudio/audiocontext-state-interrupted-expected.txt: Added.
* webaudio/audiocontext-state-interrupted.html: Added.
* webaudio/audiocontext-state.html: Added.
Canonical link: https://commits.webkit.org/161241@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-30 16:15:00 +00:00
|
|
|
function runTest() {
|
|
|
|
window.jsTestIsAsync = true;
|
|
|
|
|
2020-09-23 22:48:05 +00:00
|
|
|
context = new AudioContext();
|
2020-10-27 21:46:21 +00:00
|
|
|
context.onstatechange = onAudioContextAutoStart;
|
[iOS] When Web Audio is interrupted by a phone call, it cannot be restarted.
https://bugs.webkit.org/show_bug.cgi?id=143190
Reviewed by Darin Adler.
Source/WebCore:
Tests: webaudio/audiocontext-state-interrupted.html
webaudio/audiocontext-state.html
Implement the following methods and properties from the Web Audio spec:
close(), suspend(), resume(), onstatechange.
AudioContext will take more responsibility for tracking state and interruptions (and
AudioDestination will give up that responsibility). This means AudioContext must be a
MediaSessionClient, and own its own MediaSession. In return, AudioDestinationIOS and
AudioDestinationMac relinquish both.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::AudioContext): Set default values in header.
(WebCore::AudioContext::uninitialize): Call setState() instead of setting m_state.
(WebCore::AudioContext::addReaction): Added. Append the callback to the appropriate vector for the state.
(WebCore::AudioContext::setState): Added. Fire events and resolve the appropriate reaction callbacks for the new state.
(WebCore::AudioContext::state): Return a string representing the context's state.
(WebCore::AudioContext::stop): Close the event queue.
(WebCore::AudioContext::startRendering): Call setState().
(WebCore::AudioContext::fireCompletionEvent): Call setState().
(WebCore::AudioContext::suspendContext): Added. Add reaction callback and call suspend() on the destination node.
(WebCore::AudioContext::resumeContext): Added. Add reaction callback and call resume() on the destination node.
(WebCore::AudioContext::closeContext): Added. Add reaction callback and call close() on the destination node.
(WebCore::AudioContext::suspendPlayback): Added. Suspend playback and set state to interrupted.
(WebCore::AudioContext::mayResumePlayback): Added. Conditionally resume playback.
* bindings/js/JSAudioContextCustom.cpp:
(WebCore::JSAudioContext::suspend): Added. Create and return a new Promise object.
(WebCore::JSAudioContext::resume): Ditto.
(WebCore::JSAudioContext::close): Ditto.
* Modules/webaudio/AudioContext.idl: Add new methods and properties.
Extensive organizational changes were made to AudioContext.h to group instance
variables together and add C++11 initializers in their declarations:
* Modules/webaudio/AudioContext.h:
(WebCore::AudioContext::mediaType): Moved from AudioDestinationNode.
(WebCore::AudioContext::presentationType): Ditto.
(WebCore::AudioContext::canReceiveRemoteControlCommands): Ditto.
(WebCore::AudioContext::didReceiveRemoteControlCommand): Ditto.
(WebCore::AudioContext::overrideBackgroundPlaybackRestriction): Ditto.
Other changes to support the new AudioContext methods:
* Modules/webaudio/AudioDestinationNode.h:
(WebCore::AudioDestinationNode::resume): Add empty default virtual method.
(WebCore::AudioDestinationNode::suspend): Ditto.
(WebCore::AudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.cpp:
(WebCore::DefaultAudioDestinationNode::resume): Added. Pass to AudioDestination.
(WebCore::DefaultAudioDestinationNode::suspend): Ditto.
(WebCore::DefaultAudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.h:
* bindings/js/JSDOMPromise.h:
(WebCore::DeferredWrapper::resolve): Add an overload for a nullptr resolve value.
* dom/EventNames.h: Added 'statechange'.
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::Task::Task): Add a constructor which takes a void() callback.
Modify MediaSession, AudioSession, and MediaSessionManager to support the new
interruption behavior.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::suspendPlayback): Renamed from pausePlayback().
(WebCore::HTMLMediaElement::mayResumePlayback): Renamed from resumePlayback().
* html/HTMLMediaElement.h:
* platform/audio/AudioSession.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/AudioSession.h:
* platform/audio/MediaSession.cpp:
(WebCore::MediaSession::beginInterruption): pausePlayback() was renamed to suspendPlayback().
(WebCore::MediaSession::endInterruption): Always notify the client, telling it whether to resume.
(WebCore::MediaSession::clientWillBeginPlayback): Bail early if reentrant. Check the (new)
return value of sessionWillBeginPlayback() and remember to resume once the interruption ends.
(WebCore::MediaSession::clientWillPausePlayback): Bail early if reentrant.
(WebCore::MediaSession::pauseSession): pausePlayback() was renamed to suspendPlayback().
* platform/audio/MediaSession.h:
* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::sessionWillBeginPlayback): Return false if not allowed to break interruption or
if activating the audio session failed. Otherwise, end the interruption.
* platform/audio/MediaSessionManager.h:
* platform/audio/ios/AudioDestinationIOS.cpp:
(WebCore::AudioDestinationIOS::AudioDestinationIOS): m_mediaSession was removed.
(WebCore::AudioDestinationIOS::start): Ditto.
* platform/audio/ios/AudioDestinationIOS.h:
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return false if the AVAudioSession could not be activated.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): Do not update the now playing info if session playback was blocked.
* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestinationMac::AudioDestinationMac): m_mediaSession was removed.
* platform/audio/mac/AudioDestinationMac.h:
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive(). Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/mac/MediaSessionManagerMac.cpp:
(MediaSessionManager::updateSessionState): No longer attempt to activate the session, as this is done
MediaSessionManager::sessionWillBeginPlayback().
* testing/Internals.cpp:
(WebCore::Internals::setMediaSessionRestrictions): Add "InterruptedPlaybackNotPermitted".
LayoutTests:
* webaudio/audiocontext-state-expected.txt: Added.
* webaudio/audiocontext-state-interrupted-expected.txt: Added.
* webaudio/audiocontext-state-interrupted.html: Added.
* webaudio/audiocontext-state.html: Added.
Canonical link: https://commits.webkit.org/161241@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-30 16:15:00 +00:00
|
|
|
|
2020-10-27 21:46:21 +00:00
|
|
|
shouldBeEqualToString('context.state', 'suspended');
|
[iOS] When Web Audio is interrupted by a phone call, it cannot be restarted.
https://bugs.webkit.org/show_bug.cgi?id=143190
Reviewed by Darin Adler.
Source/WebCore:
Tests: webaudio/audiocontext-state-interrupted.html
webaudio/audiocontext-state.html
Implement the following methods and properties from the Web Audio spec:
close(), suspend(), resume(), onstatechange.
AudioContext will take more responsibility for tracking state and interruptions (and
AudioDestination will give up that responsibility). This means AudioContext must be a
MediaSessionClient, and own its own MediaSession. In return, AudioDestinationIOS and
AudioDestinationMac relinquish both.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::AudioContext): Set default values in header.
(WebCore::AudioContext::uninitialize): Call setState() instead of setting m_state.
(WebCore::AudioContext::addReaction): Added. Append the callback to the appropriate vector for the state.
(WebCore::AudioContext::setState): Added. Fire events and resolve the appropriate reaction callbacks for the new state.
(WebCore::AudioContext::state): Return a string representing the context's state.
(WebCore::AudioContext::stop): Close the event queue.
(WebCore::AudioContext::startRendering): Call setState().
(WebCore::AudioContext::fireCompletionEvent): Call setState().
(WebCore::AudioContext::suspendContext): Added. Add reaction callback and call suspend() on the destination node.
(WebCore::AudioContext::resumeContext): Added. Add reaction callback and call resume() on the destination node.
(WebCore::AudioContext::closeContext): Added. Add reaction callback and call close() on the destination node.
(WebCore::AudioContext::suspendPlayback): Added. Suspend playback and set state to interrupted.
(WebCore::AudioContext::mayResumePlayback): Added. Conditionally resume playback.
* bindings/js/JSAudioContextCustom.cpp:
(WebCore::JSAudioContext::suspend): Added. Create and return a new Promise object.
(WebCore::JSAudioContext::resume): Ditto.
(WebCore::JSAudioContext::close): Ditto.
* Modules/webaudio/AudioContext.idl: Add new methods and properties.
Extensive organizational changes were made to AudioContext.h to group instance
variables together and add C++11 initializers in their declarations:
* Modules/webaudio/AudioContext.h:
(WebCore::AudioContext::mediaType): Moved from AudioDestinationNode.
(WebCore::AudioContext::presentationType): Ditto.
(WebCore::AudioContext::canReceiveRemoteControlCommands): Ditto.
(WebCore::AudioContext::didReceiveRemoteControlCommand): Ditto.
(WebCore::AudioContext::overrideBackgroundPlaybackRestriction): Ditto.
Other changes to support the new AudioContext methods:
* Modules/webaudio/AudioDestinationNode.h:
(WebCore::AudioDestinationNode::resume): Add empty default virtual method.
(WebCore::AudioDestinationNode::suspend): Ditto.
(WebCore::AudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.cpp:
(WebCore::DefaultAudioDestinationNode::resume): Added. Pass to AudioDestination.
(WebCore::DefaultAudioDestinationNode::suspend): Ditto.
(WebCore::DefaultAudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.h:
* bindings/js/JSDOMPromise.h:
(WebCore::DeferredWrapper::resolve): Add an overload for a nullptr resolve value.
* dom/EventNames.h: Added 'statechange'.
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::Task::Task): Add a constructor which takes a void() callback.
Modify MediaSession, AudioSession, and MediaSessionManager to support the new
interruption behavior.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::suspendPlayback): Renamed from pausePlayback().
(WebCore::HTMLMediaElement::mayResumePlayback): Renamed from resumePlayback().
* html/HTMLMediaElement.h:
* platform/audio/AudioSession.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/AudioSession.h:
* platform/audio/MediaSession.cpp:
(WebCore::MediaSession::beginInterruption): pausePlayback() was renamed to suspendPlayback().
(WebCore::MediaSession::endInterruption): Always notify the client, telling it whether to resume.
(WebCore::MediaSession::clientWillBeginPlayback): Bail early if reentrant. Check the (new)
return value of sessionWillBeginPlayback() and remember to resume once the interruption ends.
(WebCore::MediaSession::clientWillPausePlayback): Bail early if reentrant.
(WebCore::MediaSession::pauseSession): pausePlayback() was renamed to suspendPlayback().
* platform/audio/MediaSession.h:
* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::sessionWillBeginPlayback): Return false if not allowed to break interruption or
if activating the audio session failed. Otherwise, end the interruption.
* platform/audio/MediaSessionManager.h:
* platform/audio/ios/AudioDestinationIOS.cpp:
(WebCore::AudioDestinationIOS::AudioDestinationIOS): m_mediaSession was removed.
(WebCore::AudioDestinationIOS::start): Ditto.
* platform/audio/ios/AudioDestinationIOS.h:
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return false if the AVAudioSession could not be activated.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): Do not update the now playing info if session playback was blocked.
* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestinationMac::AudioDestinationMac): m_mediaSession was removed.
* platform/audio/mac/AudioDestinationMac.h:
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive(). Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/mac/MediaSessionManagerMac.cpp:
(MediaSessionManager::updateSessionState): No longer attempt to activate the session, as this is done
MediaSessionManager::sessionWillBeginPlayback().
* testing/Internals.cpp:
(WebCore::Internals::setMediaSessionRestrictions): Add "InterruptedPlaybackNotPermitted".
LayoutTests:
* webaudio/audiocontext-state-expected.txt: Added.
* webaudio/audiocontext-state-interrupted-expected.txt: Added.
* webaudio/audiocontext-state-interrupted.html: Added.
* webaudio/audiocontext-state.html: Added.
Canonical link: https://commits.webkit.org/161241@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-30 16:15:00 +00:00
|
|
|
|
|
|
|
node = context.createBufferSource();
|
|
|
|
evalAndLog('node.connect(context.destination)');
|
|
|
|
}
|
|
|
|
|
|
|
|
function suspendFailed() {
|
|
|
|
testFailed('context.suspend() promise rejected');
|
|
|
|
finishJSTest();
|
|
|
|
}
|
|
|
|
|
2015-05-19 21:12:20 +00:00
|
|
|
function suspendSucceeded(value) {
|
|
|
|
if (typeof value != 'undefined') {
|
|
|
|
testFailed('context.suspend() promise should not resolve with a value.');
|
|
|
|
finishJSTest();
|
|
|
|
return;
|
|
|
|
}
|
[iOS] When Web Audio is interrupted by a phone call, it cannot be restarted.
https://bugs.webkit.org/show_bug.cgi?id=143190
Reviewed by Darin Adler.
Source/WebCore:
Tests: webaudio/audiocontext-state-interrupted.html
webaudio/audiocontext-state.html
Implement the following methods and properties from the Web Audio spec:
close(), suspend(), resume(), onstatechange.
AudioContext will take more responsibility for tracking state and interruptions (and
AudioDestination will give up that responsibility). This means AudioContext must be a
MediaSessionClient, and own its own MediaSession. In return, AudioDestinationIOS and
AudioDestinationMac relinquish both.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::AudioContext): Set default values in header.
(WebCore::AudioContext::uninitialize): Call setState() instead of setting m_state.
(WebCore::AudioContext::addReaction): Added. Append the callback to the appropriate vector for the state.
(WebCore::AudioContext::setState): Added. Fire events and resolve the appropriate reaction callbacks for the new state.
(WebCore::AudioContext::state): Return a string representing the context's state.
(WebCore::AudioContext::stop): Close the event queue.
(WebCore::AudioContext::startRendering): Call setState().
(WebCore::AudioContext::fireCompletionEvent): Call setState().
(WebCore::AudioContext::suspendContext): Added. Add reaction callback and call suspend() on the destination node.
(WebCore::AudioContext::resumeContext): Added. Add reaction callback and call resume() on the destination node.
(WebCore::AudioContext::closeContext): Added. Add reaction callback and call close() on the destination node.
(WebCore::AudioContext::suspendPlayback): Added. Suspend playback and set state to interrupted.
(WebCore::AudioContext::mayResumePlayback): Added. Conditionally resume playback.
* bindings/js/JSAudioContextCustom.cpp:
(WebCore::JSAudioContext::suspend): Added. Create and return a new Promise object.
(WebCore::JSAudioContext::resume): Ditto.
(WebCore::JSAudioContext::close): Ditto.
* Modules/webaudio/AudioContext.idl: Add new methods and properties.
Extensive organizational changes were made to AudioContext.h to group instance
variables together and add C++11 initializers in their declarations:
* Modules/webaudio/AudioContext.h:
(WebCore::AudioContext::mediaType): Moved from AudioDestinationNode.
(WebCore::AudioContext::presentationType): Ditto.
(WebCore::AudioContext::canReceiveRemoteControlCommands): Ditto.
(WebCore::AudioContext::didReceiveRemoteControlCommand): Ditto.
(WebCore::AudioContext::overrideBackgroundPlaybackRestriction): Ditto.
Other changes to support the new AudioContext methods:
* Modules/webaudio/AudioDestinationNode.h:
(WebCore::AudioDestinationNode::resume): Add empty default virtual method.
(WebCore::AudioDestinationNode::suspend): Ditto.
(WebCore::AudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.cpp:
(WebCore::DefaultAudioDestinationNode::resume): Added. Pass to AudioDestination.
(WebCore::DefaultAudioDestinationNode::suspend): Ditto.
(WebCore::DefaultAudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.h:
* bindings/js/JSDOMPromise.h:
(WebCore::DeferredWrapper::resolve): Add an overload for a nullptr resolve value.
* dom/EventNames.h: Added 'statechange'.
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::Task::Task): Add a constructor which takes a void() callback.
Modify MediaSession, AudioSession, and MediaSessionManager to support the new
interruption behavior.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::suspendPlayback): Renamed from pausePlayback().
(WebCore::HTMLMediaElement::mayResumePlayback): Renamed from resumePlayback().
* html/HTMLMediaElement.h:
* platform/audio/AudioSession.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/AudioSession.h:
* platform/audio/MediaSession.cpp:
(WebCore::MediaSession::beginInterruption): pausePlayback() was renamed to suspendPlayback().
(WebCore::MediaSession::endInterruption): Always notify the client, telling it whether to resume.
(WebCore::MediaSession::clientWillBeginPlayback): Bail early if reentrant. Check the (new)
return value of sessionWillBeginPlayback() and remember to resume once the interruption ends.
(WebCore::MediaSession::clientWillPausePlayback): Bail early if reentrant.
(WebCore::MediaSession::pauseSession): pausePlayback() was renamed to suspendPlayback().
* platform/audio/MediaSession.h:
* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::sessionWillBeginPlayback): Return false if not allowed to break interruption or
if activating the audio session failed. Otherwise, end the interruption.
* platform/audio/MediaSessionManager.h:
* platform/audio/ios/AudioDestinationIOS.cpp:
(WebCore::AudioDestinationIOS::AudioDestinationIOS): m_mediaSession was removed.
(WebCore::AudioDestinationIOS::start): Ditto.
* platform/audio/ios/AudioDestinationIOS.h:
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return false if the AVAudioSession could not be activated.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): Do not update the now playing info if session playback was blocked.
* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestinationMac::AudioDestinationMac): m_mediaSession was removed.
* platform/audio/mac/AudioDestinationMac.h:
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive(). Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/mac/MediaSessionManagerMac.cpp:
(MediaSessionManager::updateSessionState): No longer attempt to activate the session, as this is done
MediaSessionManager::sessionWillBeginPlayback().
* testing/Internals.cpp:
(WebCore::Internals::setMediaSessionRestrictions): Add "InterruptedPlaybackNotPermitted".
LayoutTests:
* webaudio/audiocontext-state-expected.txt: Added.
* webaudio/audiocontext-state-interrupted-expected.txt: Added.
* webaudio/audiocontext-state-interrupted.html: Added.
* webaudio/audiocontext-state.html: Added.
Canonical link: https://commits.webkit.org/161241@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-30 16:15:00 +00:00
|
|
|
testPassed('context.suspend() promise resolved');
|
|
|
|
shouldBe('context.state', '"suspended"');
|
|
|
|
|
|
|
|
debug('Calling context.resume()');
|
|
|
|
context.resume().then(resumeSucceeded, resumeFailed);
|
|
|
|
}
|
|
|
|
|
|
|
|
function resumeFailed() {
|
|
|
|
testFailed('context.resume() promise rejected');
|
|
|
|
finishJSTest();
|
|
|
|
}
|
|
|
|
|
2015-05-19 21:12:20 +00:00
|
|
|
function resumeSucceeded(value) {
|
|
|
|
if (typeof value != 'undefined') {
|
|
|
|
testFailed('context.resume() promise should not resolve with a value.');
|
|
|
|
finishJSTest();
|
|
|
|
return;
|
|
|
|
}
|
[iOS] When Web Audio is interrupted by a phone call, it cannot be restarted.
https://bugs.webkit.org/show_bug.cgi?id=143190
Reviewed by Darin Adler.
Source/WebCore:
Tests: webaudio/audiocontext-state-interrupted.html
webaudio/audiocontext-state.html
Implement the following methods and properties from the Web Audio spec:
close(), suspend(), resume(), onstatechange.
AudioContext will take more responsibility for tracking state and interruptions (and
AudioDestination will give up that responsibility). This means AudioContext must be a
MediaSessionClient, and own its own MediaSession. In return, AudioDestinationIOS and
AudioDestinationMac relinquish both.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::AudioContext): Set default values in header.
(WebCore::AudioContext::uninitialize): Call setState() instead of setting m_state.
(WebCore::AudioContext::addReaction): Added. Append the callback to the appropriate vector for the state.
(WebCore::AudioContext::setState): Added. Fire events and resolve the appropriate reaction callbacks for the new state.
(WebCore::AudioContext::state): Return a string representing the context's state.
(WebCore::AudioContext::stop): Close the event queue.
(WebCore::AudioContext::startRendering): Call setState().
(WebCore::AudioContext::fireCompletionEvent): Call setState().
(WebCore::AudioContext::suspendContext): Added. Add reaction callback and call suspend() on the destination node.
(WebCore::AudioContext::resumeContext): Added. Add reaction callback and call resume() on the destination node.
(WebCore::AudioContext::closeContext): Added. Add reaction callback and call close() on the destination node.
(WebCore::AudioContext::suspendPlayback): Added. Suspend playback and set state to interrupted.
(WebCore::AudioContext::mayResumePlayback): Added. Conditionally resume playback.
* bindings/js/JSAudioContextCustom.cpp:
(WebCore::JSAudioContext::suspend): Added. Create and return a new Promise object.
(WebCore::JSAudioContext::resume): Ditto.
(WebCore::JSAudioContext::close): Ditto.
* Modules/webaudio/AudioContext.idl: Add new methods and properties.
Extensive organizational changes were made to AudioContext.h to group instance
variables together and add C++11 initializers in their declarations:
* Modules/webaudio/AudioContext.h:
(WebCore::AudioContext::mediaType): Moved from AudioDestinationNode.
(WebCore::AudioContext::presentationType): Ditto.
(WebCore::AudioContext::canReceiveRemoteControlCommands): Ditto.
(WebCore::AudioContext::didReceiveRemoteControlCommand): Ditto.
(WebCore::AudioContext::overrideBackgroundPlaybackRestriction): Ditto.
Other changes to support the new AudioContext methods:
* Modules/webaudio/AudioDestinationNode.h:
(WebCore::AudioDestinationNode::resume): Add empty default virtual method.
(WebCore::AudioDestinationNode::suspend): Ditto.
(WebCore::AudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.cpp:
(WebCore::DefaultAudioDestinationNode::resume): Added. Pass to AudioDestination.
(WebCore::DefaultAudioDestinationNode::suspend): Ditto.
(WebCore::DefaultAudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.h:
* bindings/js/JSDOMPromise.h:
(WebCore::DeferredWrapper::resolve): Add an overload for a nullptr resolve value.
* dom/EventNames.h: Added 'statechange'.
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::Task::Task): Add a constructor which takes a void() callback.
Modify MediaSession, AudioSession, and MediaSessionManager to support the new
interruption behavior.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::suspendPlayback): Renamed from pausePlayback().
(WebCore::HTMLMediaElement::mayResumePlayback): Renamed from resumePlayback().
* html/HTMLMediaElement.h:
* platform/audio/AudioSession.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/AudioSession.h:
* platform/audio/MediaSession.cpp:
(WebCore::MediaSession::beginInterruption): pausePlayback() was renamed to suspendPlayback().
(WebCore::MediaSession::endInterruption): Always notify the client, telling it whether to resume.
(WebCore::MediaSession::clientWillBeginPlayback): Bail early if reentrant. Check the (new)
return value of sessionWillBeginPlayback() and remember to resume once the interruption ends.
(WebCore::MediaSession::clientWillPausePlayback): Bail early if reentrant.
(WebCore::MediaSession::pauseSession): pausePlayback() was renamed to suspendPlayback().
* platform/audio/MediaSession.h:
* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::sessionWillBeginPlayback): Return false if not allowed to break interruption or
if activating the audio session failed. Otherwise, end the interruption.
* platform/audio/MediaSessionManager.h:
* platform/audio/ios/AudioDestinationIOS.cpp:
(WebCore::AudioDestinationIOS::AudioDestinationIOS): m_mediaSession was removed.
(WebCore::AudioDestinationIOS::start): Ditto.
* platform/audio/ios/AudioDestinationIOS.h:
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return false if the AVAudioSession could not be activated.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): Do not update the now playing info if session playback was blocked.
* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestinationMac::AudioDestinationMac): m_mediaSession was removed.
* platform/audio/mac/AudioDestinationMac.h:
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive(). Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/mac/MediaSessionManagerMac.cpp:
(MediaSessionManager::updateSessionState): No longer attempt to activate the session, as this is done
MediaSessionManager::sessionWillBeginPlayback().
* testing/Internals.cpp:
(WebCore::Internals::setMediaSessionRestrictions): Add "InterruptedPlaybackNotPermitted".
LayoutTests:
* webaudio/audiocontext-state-expected.txt: Added.
* webaudio/audiocontext-state-interrupted-expected.txt: Added.
* webaudio/audiocontext-state-interrupted.html: Added.
* webaudio/audiocontext-state.html: Added.
Canonical link: https://commits.webkit.org/161241@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-30 16:15:00 +00:00
|
|
|
testPassed('context.resume() promise resolved');
|
|
|
|
shouldBe('context.state', '"running"');
|
|
|
|
|
|
|
|
debug('Calling context.close()');
|
|
|
|
context.close().then(closeSucceeded, closeFailed);
|
|
|
|
}
|
|
|
|
|
|
|
|
function closeFailed() {
|
|
|
|
testFailed('context.close() promise rejected');
|
|
|
|
finishJSTest();
|
|
|
|
}
|
|
|
|
|
2015-05-19 21:12:20 +00:00
|
|
|
function closeSucceeded(value) {
|
|
|
|
if (typeof value != 'undefined') {
|
|
|
|
testFailed('context.closed() promise should not resolve with a value.');
|
|
|
|
finishJSTest();
|
|
|
|
return;
|
|
|
|
}
|
[iOS] When Web Audio is interrupted by a phone call, it cannot be restarted.
https://bugs.webkit.org/show_bug.cgi?id=143190
Reviewed by Darin Adler.
Source/WebCore:
Tests: webaudio/audiocontext-state-interrupted.html
webaudio/audiocontext-state.html
Implement the following methods and properties from the Web Audio spec:
close(), suspend(), resume(), onstatechange.
AudioContext will take more responsibility for tracking state and interruptions (and
AudioDestination will give up that responsibility). This means AudioContext must be a
MediaSessionClient, and own its own MediaSession. In return, AudioDestinationIOS and
AudioDestinationMac relinquish both.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::AudioContext): Set default values in header.
(WebCore::AudioContext::uninitialize): Call setState() instead of setting m_state.
(WebCore::AudioContext::addReaction): Added. Append the callback to the appropriate vector for the state.
(WebCore::AudioContext::setState): Added. Fire events and resolve the appropriate reaction callbacks for the new state.
(WebCore::AudioContext::state): Return a string representing the context's state.
(WebCore::AudioContext::stop): Close the event queue.
(WebCore::AudioContext::startRendering): Call setState().
(WebCore::AudioContext::fireCompletionEvent): Call setState().
(WebCore::AudioContext::suspendContext): Added. Add reaction callback and call suspend() on the destination node.
(WebCore::AudioContext::resumeContext): Added. Add reaction callback and call resume() on the destination node.
(WebCore::AudioContext::closeContext): Added. Add reaction callback and call close() on the destination node.
(WebCore::AudioContext::suspendPlayback): Added. Suspend playback and set state to interrupted.
(WebCore::AudioContext::mayResumePlayback): Added. Conditionally resume playback.
* bindings/js/JSAudioContextCustom.cpp:
(WebCore::JSAudioContext::suspend): Added. Create and return a new Promise object.
(WebCore::JSAudioContext::resume): Ditto.
(WebCore::JSAudioContext::close): Ditto.
* Modules/webaudio/AudioContext.idl: Add new methods and properties.
Extensive organizational changes were made to AudioContext.h to group instance
variables together and add C++11 initializers in their declarations:
* Modules/webaudio/AudioContext.h:
(WebCore::AudioContext::mediaType): Moved from AudioDestinationNode.
(WebCore::AudioContext::presentationType): Ditto.
(WebCore::AudioContext::canReceiveRemoteControlCommands): Ditto.
(WebCore::AudioContext::didReceiveRemoteControlCommand): Ditto.
(WebCore::AudioContext::overrideBackgroundPlaybackRestriction): Ditto.
Other changes to support the new AudioContext methods:
* Modules/webaudio/AudioDestinationNode.h:
(WebCore::AudioDestinationNode::resume): Add empty default virtual method.
(WebCore::AudioDestinationNode::suspend): Ditto.
(WebCore::AudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.cpp:
(WebCore::DefaultAudioDestinationNode::resume): Added. Pass to AudioDestination.
(WebCore::DefaultAudioDestinationNode::suspend): Ditto.
(WebCore::DefaultAudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.h:
* bindings/js/JSDOMPromise.h:
(WebCore::DeferredWrapper::resolve): Add an overload for a nullptr resolve value.
* dom/EventNames.h: Added 'statechange'.
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::Task::Task): Add a constructor which takes a void() callback.
Modify MediaSession, AudioSession, and MediaSessionManager to support the new
interruption behavior.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::suspendPlayback): Renamed from pausePlayback().
(WebCore::HTMLMediaElement::mayResumePlayback): Renamed from resumePlayback().
* html/HTMLMediaElement.h:
* platform/audio/AudioSession.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/AudioSession.h:
* platform/audio/MediaSession.cpp:
(WebCore::MediaSession::beginInterruption): pausePlayback() was renamed to suspendPlayback().
(WebCore::MediaSession::endInterruption): Always notify the client, telling it whether to resume.
(WebCore::MediaSession::clientWillBeginPlayback): Bail early if reentrant. Check the (new)
return value of sessionWillBeginPlayback() and remember to resume once the interruption ends.
(WebCore::MediaSession::clientWillPausePlayback): Bail early if reentrant.
(WebCore::MediaSession::pauseSession): pausePlayback() was renamed to suspendPlayback().
* platform/audio/MediaSession.h:
* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::sessionWillBeginPlayback): Return false if not allowed to break interruption or
if activating the audio session failed. Otherwise, end the interruption.
* platform/audio/MediaSessionManager.h:
* platform/audio/ios/AudioDestinationIOS.cpp:
(WebCore::AudioDestinationIOS::AudioDestinationIOS): m_mediaSession was removed.
(WebCore::AudioDestinationIOS::start): Ditto.
* platform/audio/ios/AudioDestinationIOS.h:
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return false if the AVAudioSession could not be activated.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): Do not update the now playing info if session playback was blocked.
* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestinationMac::AudioDestinationMac): m_mediaSession was removed.
* platform/audio/mac/AudioDestinationMac.h:
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive(). Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/mac/MediaSessionManagerMac.cpp:
(MediaSessionManager::updateSessionState): No longer attempt to activate the session, as this is done
MediaSessionManager::sessionWillBeginPlayback().
* testing/Internals.cpp:
(WebCore::Internals::setMediaSessionRestrictions): Add "InterruptedPlaybackNotPermitted".
LayoutTests:
* webaudio/audiocontext-state-expected.txt: Added.
* webaudio/audiocontext-state-interrupted-expected.txt: Added.
* webaudio/audiocontext-state-interrupted.html: Added.
* webaudio/audiocontext-state.html: Added.
Canonical link: https://commits.webkit.org/161241@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-30 16:15:00 +00:00
|
|
|
testPassed('context.close() promise resolved');
|
|
|
|
shouldBe('context.state', '"closed"');
|
|
|
|
|
|
|
|
debug('Calling context.resume() (should fail)');
|
|
|
|
context.resume().then(resumeSucceededIncorrectly, resumeFailedCorrectly);
|
|
|
|
}
|
|
|
|
|
|
|
|
function resumeSucceededIncorrectly() {
|
|
|
|
testFailed('context.resume() promise resolved (should have rejected)');
|
|
|
|
finishJSTest();
|
|
|
|
}
|
|
|
|
|
2015-05-20 20:20:09 +00:00
|
|
|
function resumeFailedCorrectly(value) {
|
[iOS] When Web Audio is interrupted by a phone call, it cannot be restarted.
https://bugs.webkit.org/show_bug.cgi?id=143190
Reviewed by Darin Adler.
Source/WebCore:
Tests: webaudio/audiocontext-state-interrupted.html
webaudio/audiocontext-state.html
Implement the following methods and properties from the Web Audio spec:
close(), suspend(), resume(), onstatechange.
AudioContext will take more responsibility for tracking state and interruptions (and
AudioDestination will give up that responsibility). This means AudioContext must be a
MediaSessionClient, and own its own MediaSession. In return, AudioDestinationIOS and
AudioDestinationMac relinquish both.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::AudioContext): Set default values in header.
(WebCore::AudioContext::uninitialize): Call setState() instead of setting m_state.
(WebCore::AudioContext::addReaction): Added. Append the callback to the appropriate vector for the state.
(WebCore::AudioContext::setState): Added. Fire events and resolve the appropriate reaction callbacks for the new state.
(WebCore::AudioContext::state): Return a string representing the context's state.
(WebCore::AudioContext::stop): Close the event queue.
(WebCore::AudioContext::startRendering): Call setState().
(WebCore::AudioContext::fireCompletionEvent): Call setState().
(WebCore::AudioContext::suspendContext): Added. Add reaction callback and call suspend() on the destination node.
(WebCore::AudioContext::resumeContext): Added. Add reaction callback and call resume() on the destination node.
(WebCore::AudioContext::closeContext): Added. Add reaction callback and call close() on the destination node.
(WebCore::AudioContext::suspendPlayback): Added. Suspend playback and set state to interrupted.
(WebCore::AudioContext::mayResumePlayback): Added. Conditionally resume playback.
* bindings/js/JSAudioContextCustom.cpp:
(WebCore::JSAudioContext::suspend): Added. Create and return a new Promise object.
(WebCore::JSAudioContext::resume): Ditto.
(WebCore::JSAudioContext::close): Ditto.
* Modules/webaudio/AudioContext.idl: Add new methods and properties.
Extensive organizational changes were made to AudioContext.h to group instance
variables together and add C++11 initializers in their declarations:
* Modules/webaudio/AudioContext.h:
(WebCore::AudioContext::mediaType): Moved from AudioDestinationNode.
(WebCore::AudioContext::presentationType): Ditto.
(WebCore::AudioContext::canReceiveRemoteControlCommands): Ditto.
(WebCore::AudioContext::didReceiveRemoteControlCommand): Ditto.
(WebCore::AudioContext::overrideBackgroundPlaybackRestriction): Ditto.
Other changes to support the new AudioContext methods:
* Modules/webaudio/AudioDestinationNode.h:
(WebCore::AudioDestinationNode::resume): Add empty default virtual method.
(WebCore::AudioDestinationNode::suspend): Ditto.
(WebCore::AudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.cpp:
(WebCore::DefaultAudioDestinationNode::resume): Added. Pass to AudioDestination.
(WebCore::DefaultAudioDestinationNode::suspend): Ditto.
(WebCore::DefaultAudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.h:
* bindings/js/JSDOMPromise.h:
(WebCore::DeferredWrapper::resolve): Add an overload for a nullptr resolve value.
* dom/EventNames.h: Added 'statechange'.
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::Task::Task): Add a constructor which takes a void() callback.
Modify MediaSession, AudioSession, and MediaSessionManager to support the new
interruption behavior.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::suspendPlayback): Renamed from pausePlayback().
(WebCore::HTMLMediaElement::mayResumePlayback): Renamed from resumePlayback().
* html/HTMLMediaElement.h:
* platform/audio/AudioSession.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/AudioSession.h:
* platform/audio/MediaSession.cpp:
(WebCore::MediaSession::beginInterruption): pausePlayback() was renamed to suspendPlayback().
(WebCore::MediaSession::endInterruption): Always notify the client, telling it whether to resume.
(WebCore::MediaSession::clientWillBeginPlayback): Bail early if reentrant. Check the (new)
return value of sessionWillBeginPlayback() and remember to resume once the interruption ends.
(WebCore::MediaSession::clientWillPausePlayback): Bail early if reentrant.
(WebCore::MediaSession::pauseSession): pausePlayback() was renamed to suspendPlayback().
* platform/audio/MediaSession.h:
* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::sessionWillBeginPlayback): Return false if not allowed to break interruption or
if activating the audio session failed. Otherwise, end the interruption.
* platform/audio/MediaSessionManager.h:
* platform/audio/ios/AudioDestinationIOS.cpp:
(WebCore::AudioDestinationIOS::AudioDestinationIOS): m_mediaSession was removed.
(WebCore::AudioDestinationIOS::start): Ditto.
* platform/audio/ios/AudioDestinationIOS.h:
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return false if the AVAudioSession could not be activated.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): Do not update the now playing info if session playback was blocked.
* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestinationMac::AudioDestinationMac): m_mediaSession was removed.
* platform/audio/mac/AudioDestinationMac.h:
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive(). Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/mac/MediaSessionManagerMac.cpp:
(MediaSessionManager::updateSessionState): No longer attempt to activate the session, as this is done
MediaSessionManager::sessionWillBeginPlayback().
* testing/Internals.cpp:
(WebCore::Internals::setMediaSessionRestrictions): Add "InterruptedPlaybackNotPermitted".
LayoutTests:
* webaudio/audiocontext-state-expected.txt: Added.
* webaudio/audiocontext-state-interrupted-expected.txt: Added.
* webaudio/audiocontext-state-interrupted.html: Added.
* webaudio/audiocontext-state.html: Added.
Canonical link: https://commits.webkit.org/161241@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-30 16:15:00 +00:00
|
|
|
testPassed('context.resume() promise rejected (correctly)');
|
|
|
|
shouldBe('context.state', '"closed"');
|
|
|
|
|
|
|
|
debug('Calling context.suspend() (should fail)');
|
|
|
|
context.suspend().then(suspendSucceededIncorrectly, suspendFailedCorrectly);
|
|
|
|
}
|
|
|
|
|
|
|
|
function suspendSucceededIncorrectly() {
|
|
|
|
testFailed('context.suspend() promise resolved (should have rejected)');
|
|
|
|
finishJSTest();
|
|
|
|
}
|
|
|
|
|
|
|
|
function suspendFailedCorrectly() {
|
2015-05-20 20:20:09 +00:00
|
|
|
testPassed('context.suspend() promise rejected (correctly)');
|
|
|
|
if (typeof value != 'undefined')
|
|
|
|
testFailed('No value should be passed to the context.suspend() promise rejected callback');
|
[iOS] When Web Audio is interrupted by a phone call, it cannot be restarted.
https://bugs.webkit.org/show_bug.cgi?id=143190
Reviewed by Darin Adler.
Source/WebCore:
Tests: webaudio/audiocontext-state-interrupted.html
webaudio/audiocontext-state.html
Implement the following methods and properties from the Web Audio spec:
close(), suspend(), resume(), onstatechange.
AudioContext will take more responsibility for tracking state and interruptions (and
AudioDestination will give up that responsibility). This means AudioContext must be a
MediaSessionClient, and own its own MediaSession. In return, AudioDestinationIOS and
AudioDestinationMac relinquish both.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::AudioContext): Set default values in header.
(WebCore::AudioContext::uninitialize): Call setState() instead of setting m_state.
(WebCore::AudioContext::addReaction): Added. Append the callback to the appropriate vector for the state.
(WebCore::AudioContext::setState): Added. Fire events and resolve the appropriate reaction callbacks for the new state.
(WebCore::AudioContext::state): Return a string representing the context's state.
(WebCore::AudioContext::stop): Close the event queue.
(WebCore::AudioContext::startRendering): Call setState().
(WebCore::AudioContext::fireCompletionEvent): Call setState().
(WebCore::AudioContext::suspendContext): Added. Add reaction callback and call suspend() on the destination node.
(WebCore::AudioContext::resumeContext): Added. Add reaction callback and call resume() on the destination node.
(WebCore::AudioContext::closeContext): Added. Add reaction callback and call close() on the destination node.
(WebCore::AudioContext::suspendPlayback): Added. Suspend playback and set state to interrupted.
(WebCore::AudioContext::mayResumePlayback): Added. Conditionally resume playback.
* bindings/js/JSAudioContextCustom.cpp:
(WebCore::JSAudioContext::suspend): Added. Create and return a new Promise object.
(WebCore::JSAudioContext::resume): Ditto.
(WebCore::JSAudioContext::close): Ditto.
* Modules/webaudio/AudioContext.idl: Add new methods and properties.
Extensive organizational changes were made to AudioContext.h to group instance
variables together and add C++11 initializers in their declarations:
* Modules/webaudio/AudioContext.h:
(WebCore::AudioContext::mediaType): Moved from AudioDestinationNode.
(WebCore::AudioContext::presentationType): Ditto.
(WebCore::AudioContext::canReceiveRemoteControlCommands): Ditto.
(WebCore::AudioContext::didReceiveRemoteControlCommand): Ditto.
(WebCore::AudioContext::overrideBackgroundPlaybackRestriction): Ditto.
Other changes to support the new AudioContext methods:
* Modules/webaudio/AudioDestinationNode.h:
(WebCore::AudioDestinationNode::resume): Add empty default virtual method.
(WebCore::AudioDestinationNode::suspend): Ditto.
(WebCore::AudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.cpp:
(WebCore::DefaultAudioDestinationNode::resume): Added. Pass to AudioDestination.
(WebCore::DefaultAudioDestinationNode::suspend): Ditto.
(WebCore::DefaultAudioDestinationNode::close): Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.h:
* bindings/js/JSDOMPromise.h:
(WebCore::DeferredWrapper::resolve): Add an overload for a nullptr resolve value.
* dom/EventNames.h: Added 'statechange'.
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::Task::Task): Add a constructor which takes a void() callback.
Modify MediaSession, AudioSession, and MediaSessionManager to support the new
interruption behavior.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::suspendPlayback): Renamed from pausePlayback().
(WebCore::HTMLMediaElement::mayResumePlayback): Renamed from resumePlayback().
* html/HTMLMediaElement.h:
* platform/audio/AudioSession.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/AudioSession.h:
* platform/audio/MediaSession.cpp:
(WebCore::MediaSession::beginInterruption): pausePlayback() was renamed to suspendPlayback().
(WebCore::MediaSession::endInterruption): Always notify the client, telling it whether to resume.
(WebCore::MediaSession::clientWillBeginPlayback): Bail early if reentrant. Check the (new)
return value of sessionWillBeginPlayback() and remember to resume once the interruption ends.
(WebCore::MediaSession::clientWillPausePlayback): Bail early if reentrant.
(WebCore::MediaSession::pauseSession): pausePlayback() was renamed to suspendPlayback().
* platform/audio/MediaSession.h:
* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::sessionWillBeginPlayback): Return false if not allowed to break interruption or
if activating the audio session failed. Otherwise, end the interruption.
* platform/audio/MediaSessionManager.h:
* platform/audio/ios/AudioDestinationIOS.cpp:
(WebCore::AudioDestinationIOS::AudioDestinationIOS): m_mediaSession was removed.
(WebCore::AudioDestinationIOS::start): Ditto.
* platform/audio/ios/AudioDestinationIOS.h:
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive. Return false if the AVAudioSession could not be activated.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): Do not update the now playing info if session playback was blocked.
* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestinationMac::AudioDestinationMac): m_mediaSession was removed.
* platform/audio/mac/AudioDestinationMac.h:
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::tryToSetActive): Renamed from setActive(). Return true by default.
(WebCore::AudioSession::setActive): Deleted.
* platform/audio/mac/MediaSessionManagerMac.cpp:
(MediaSessionManager::updateSessionState): No longer attempt to activate the session, as this is done
MediaSessionManager::sessionWillBeginPlayback().
* testing/Internals.cpp:
(WebCore::Internals::setMediaSessionRestrictions): Add "InterruptedPlaybackNotPermitted".
LayoutTests:
* webaudio/audiocontext-state-expected.txt: Added.
* webaudio/audiocontext-state-interrupted-expected.txt: Added.
* webaudio/audiocontext-state-interrupted.html: Added.
* webaudio/audiocontext-state.html: Added.
Canonical link: https://commits.webkit.org/161241@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-30 16:15:00 +00:00
|
|
|
shouldBe('context.state', '"closed"');
|
|
|
|
finishJSTest();
|
|
|
|
}
|
|
|
|
|
|
|
|
runTest();
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|