Commit 1ed2613e authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

Source/WebCore: [BlackBerry] Tab awareness for HTML5 concurrent audio

https://bugs.webkit.org/show_bug.cgi?id=82930
Support for concurrent HTML5 audio improvements being made in
the platform library, which need to be aware of tabs and tab
visibility. PR96004.

Patch by Max Feil <mfeil@rim.com> on 2012-04-18
Reviewed by George Staikos.

Test: media/audio-concurrent-supported.html

* platform/blackberry/PageClientBlackBerry.h:
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
(WebCore::MediaPlayerPrivate::MediaPlayerPrivate):
(WebCore::MediaPlayerPrivate::showErrorDialog):
(WebCore::MediaPlayerPrivate::isTabVisible):
(WebCore):
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:
(MediaPlayerPrivate):

Source/WebKit/blackberry: [BlackBerry] Tab awareness for HTML5 concurrent audio
https://bugs.webkit.org/show_bug.cgi?id=82930
Support for concurrent HTML5 audio improvements being made in
the platform library, which need to be aware of tabs and tab
visibility. PR96004.

Patch by Max Feil <mfeil@rim.com> on 2012-04-18
Reviewed by George Staikos.

* Api/WebPageClient.h:
* Api/WebPage_p.h:
(BlackBerry::WebKit::WebPagePrivate::isVisible):

LayoutTests: [BlackBerry] Tab awareness for HTML5 concurrent audio
https://bugs.webkit.org/show_bug.cgi?id=82930
Layout test for concurrent HTML5 audio. This is a simple test
to confirm that multiple audio elements can play at the same time.

Patch by Max Feil <mfeil@rim.com> on 2012-04-18
Reviewed by George Staikos.

* media/audio-concurrent-supported-expected.txt: Added.
* media/audio-concurrent-supported.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114493 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a97b6fb9
2012-04-18 Max Feil <mfeil@rim.com>
[BlackBerry] Tab awareness for HTML5 concurrent audio
https://bugs.webkit.org/show_bug.cgi?id=82930
Layout test for concurrent HTML5 audio. This is a simple test
to confirm that multiple audio elements can play at the same time.
Reviewed by George Staikos.
* media/audio-concurrent-supported-expected.txt: Added.
* media/audio-concurrent-supported.html: Added.
2012-04-18 Zoltan Arvai <zarvai@inf.u-szeged.hu>
 
[Qt] Unreviewed gardening, skipping test that uses disabled feature SHADOW_DOM
Test that multiple audio elements can play concurrently.
Starting a total of 2 concurrent audio elements.
EVENT(0, canplaythrough)
EXPECTED (0, testElement.currentTime == '0') OK
EVENT(0, playing)
EXPECTED (0, testElement.currentTime > '0') OK
EVENT(1, canplaythrough)
EXPECTED (1, testElement.currentTime == '0') OK
EVENT(1, playing)
EXPECTED (1, testElement.currentTime > '0') OK
Making sure all 2 audio elements are in playing state:
EXPECTED (0, testElement.paused == 'false') OK
EXPECTED (1, testElement.paused == 'false') OK
END OF TEST
<html>
<title>Test of concurrent HTML5 audio</title>
<body>
<p>Test that multiple audio elements can play concurrently.</p>
<script src=video-test.js></script>
<script src=media-file.js></script>
<script>
var maxPlayers = 2; // Number of concurrent audio elements to test. For larger values a longer media file is needed.
var timeupdateEventCount = 0;
var audioElementCount = 0;
function errorListener(event)
{
logResult(false, "Element " + audioElementCount + " caught 'error' event, audio.error.code = " + this.error.code);
endTest();
}
function canplaythroughListener(event)
{
consoleWrite("EVENT(" + audioElementCount + ", canplaythrough)");
testElement = this;
testExpected(audioElementCount + ", testElement.currentTime", 0);
this.play();
}
function playingListener(event)
{
consoleWrite("EVENT(" + audioElementCount + ", playing)");
}
function timeupdateListener(event)
{
++timeupdateEventCount;
// wait 2 timeupdate events so we are sure the media engine is
// playing the media.
if (timeupdateEventCount >= 2) {
// make sure time is advancing
testElement = this;
testExpected(audioElementCount + ", testElement.currentTime", 0, '>');
this.removeEventListener('timeupdate', timeupdateListener);
if (++audioElementCount >= maxPlayers) {
// All audio elements have been started playing. Make sure
// all of them are still playing.
consoleWrite("Making sure all " + maxPlayers + " audio elements are in playing state:");
for (var i = 0; i < maxPlayers; i++) {
testElement = document.getElementsByTagName('audio')[i];
testExpected(i + ", testElement.paused", false);
}
endTest();
} else {
// Start the next audio element
testAudioElement(audioElementCount);
}
}
}
function testAudioElement(count)
{
var audioElement = document.getElementsByTagName('audio')[count];
audioElement.addEventListener('error', errorListener);
audioElement.addEventListener('canplaythrough', canplaythroughListener);
timeupdateEventCount = 0;
audioElement.addEventListener('timeupdate', timeupdateListener);
audioElement.addEventListener('playing', playingListener);
audioElement.src = findMediaFile("audio", "content/silence");
}
consoleWrite("Starting a total of " + maxPlayers + " concurrent audio elements.");
for (var i = 0; i < maxPlayers; i++)
document.write("<audio controls></audio>");
testAudioElement(0);
</script>
</body>
</html>
2012-04-18 Max Feil <mfeil@rim.com>
[BlackBerry] Tab awareness for HTML5 concurrent audio
https://bugs.webkit.org/show_bug.cgi?id=82930
Support for concurrent HTML5 audio improvements being made in
the platform library, which need to be aware of tabs and tab
visibility. PR96004.
Reviewed by George Staikos.
Test: media/audio-concurrent-supported.html
* platform/blackberry/PageClientBlackBerry.h:
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
(WebCore::MediaPlayerPrivate::MediaPlayerPrivate):
(WebCore::MediaPlayerPrivate::showErrorDialog):
(WebCore::MediaPlayerPrivate::isTabVisible):
(WebCore):
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:
(MediaPlayerPrivate):
2012-04-18 Noel Gordon <noel.gordon@gmail.com>
 
[CG] ImageBuffer: check getPremultipliedImageData() error return
......@@ -69,6 +69,7 @@ public:
virtual WebCore::IntSize viewportSize() const = 0;
virtual int showAlertDialog(BlackBerry::WebKit::WebPageClient::AlertType) = 0;
virtual bool isActive() const = 0;
virtual bool isVisible() const = 0;
virtual bool authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&, WebCore::Credential&) = 0;
virtual SaveCredentialType notifyShouldSaveCredential(bool) = 0;
};
......
......@@ -97,11 +97,6 @@ void MediaPlayerPrivate::setCertificatePath(const String& caPath)
MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
: m_webCorePlayer(player)
#if USE(ACCELERATED_COMPOSITING)
, m_platformPlayer(new MMRPlayer(this, true))
#else
, m_platformPlayer(new MMRPlayer(this, false))
#endif
, m_networkState(MediaPlayer::Empty)
, m_readyState(MediaPlayer::HaveNothing)
, m_fullscreenWebPageClient(0)
......@@ -115,6 +110,14 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
, m_waitMetadataTimer(this, &MediaPlayerPrivate::waitMetadataTimerFired)
, m_waitMetadataPopDialogCounter(0)
{
void* tabId = 0;
if (frameView() && frameView()->hostWindow())
tabId = frameView()->hostWindow()->platformPageClient();
#if USE(ACCELERATED_COMPOSITING)
m_platformPlayer = new MMRPlayer(this, tabId, true);
#else
m_platformPlayer = new MMRPlayer(this, tabId, false);
#endif
}
MediaPlayerPrivate::~MediaPlayerPrivate()
......@@ -690,10 +693,8 @@ int MediaPlayerPrivate::showErrorDialog(MMRPlayer::Error type)
}
int rc = 0;
HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient());
Document* topdoc = element->document()->topDocument();
if (topdoc->view() && topdoc->view()->hostWindow())
rc = topdoc->view()->hostWindow()->platformPageClient()->showAlertDialog(atype);
if (frameView() && frameView()->hostWindow())
rc = frameView()->hostWindow()->platformPageClient()->showAlertDialog(atype);
return rc;
}
......@@ -721,6 +722,13 @@ bool MediaPlayerPrivate::isFullscreen() const
return m_fullscreenWebPageClient;
}
bool MediaPlayerPrivate::isTabVisible() const
{
if (frameView() && frameView()->hostWindow())
return frameView()->hostWindow()->platformPageClient()->isVisible();
return true;
}
#if USE(ACCELERATED_COMPOSITING)
static const double BufferingAnimationDelay = 1.0 / 24;
static char* s_bufferingImageData = 0;
......
......@@ -132,6 +132,7 @@ public:
#endif
virtual bool isFullscreen() const;
virtual bool isTabVisible() const;
virtual int showErrorDialog(BlackBerry::Platform::MMRPlayer::Error);
virtual BlackBerry::Platform::Graphics::Window* platformWindow();
......
......@@ -222,6 +222,7 @@ public:
virtual bool lockOrientation(bool landscape) = 0;
virtual void unlockOrientation() = 0;
virtual bool isActive() const = 0;
virtual bool isVisible() const = 0;
virtual void requestWebGLPermission(const WebString&) = 0;
virtual void setToolTip(WebString) = 0;
......
......@@ -178,6 +178,7 @@ public:
virtual double currentZoomFactor() const;
virtual int showAlertDialog(WebPageClient::AlertType atype);
virtual bool isActive() const;
virtual bool isVisible() const { return m_visible; }
virtual bool authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&, WebCore::Credential&);
virtual SaveCredentialType notifyShouldSaveCredential(bool);
......
2012-04-18 Max Feil <mfeil@rim.com>
[BlackBerry] Tab awareness for HTML5 concurrent audio
https://bugs.webkit.org/show_bug.cgi?id=82930
Support for concurrent HTML5 audio improvements being made in
the platform library, which need to be aware of tabs and tab
visibility. PR96004.
Reviewed by George Staikos.
* Api/WebPageClient.h:
* Api/WebPage_p.h:
(BlackBerry::WebKit::WebPagePrivate::isVisible):
2012-04-17 Jacky Jiang <zhajiang@rim.com>
[BlackBerry] Viewport metatag doesn't disable double-tap zoom
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment