зеркало из https://github.com/mozilla/pjs.git
Bug 499874 - Move Wave decoder to ended state when seeking to end of media. r=roc
--HG-- extra : rebase_source : 8cad22f7269f9e4a9ff0f9885036b2a47f525b7d
This commit is contained in:
Родитель
da8dcc38aa
Коммит
63158cc63b
|
@ -85,6 +85,7 @@ _TEST_FILES = \
|
|||
test_audio2.html \
|
||||
test_autobuffer.html \
|
||||
test_autoplay.html \
|
||||
test_bug495300.html \
|
||||
test_can_play_type.html \
|
||||
test_constants.html \
|
||||
test_controls.html \
|
||||
|
@ -182,7 +183,6 @@ _TEST_FILES += \
|
|||
test_bug486646.html \
|
||||
test_bug493187.html \
|
||||
test_bug495145.html \
|
||||
test_bug495300.html \
|
||||
test_bug495319.html \
|
||||
test_closing_connections.html \
|
||||
test_contentDuration1.html \
|
||||
|
|
|
@ -86,6 +86,7 @@ var gErrorTests = [
|
|||
var gSeekTests = [
|
||||
{ name:"r11025_s16_c1.wav", type:"audio/x-wav", duration:1.0 },
|
||||
{ name:"seek.ogv", type:"video/ogg", duration:3.966 },
|
||||
{ name:"320x240.ogv", type:"video/ogg", duration:0.233 },
|
||||
{ name:"bogus.duh", type:"bogus/duh", duration:123 }
|
||||
];
|
||||
|
||||
|
|
|
@ -9,26 +9,51 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=495300
|
|||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=495300">Mozilla Bug 495300</a>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
var v;
|
||||
var completed = false;
|
||||
var testsWaiting = 0;
|
||||
|
||||
function start(event) {
|
||||
event.target.currentTime = event.target.duration + 1;
|
||||
function mediaEnded(event) {
|
||||
ok(true, "Got expected 'ended' event: " + event.target.currentSrc);
|
||||
|
||||
if (event.target._expectedDuration)
|
||||
ok(Math.abs(event.target.currentTime - event.target._expectedDuration) < 0.1,
|
||||
"currentTime equals duration: " + event.target.currentSrc);
|
||||
|
||||
if (--testsWaiting == 0)
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function didEnd(event) {
|
||||
ok(true, "Got ended event");
|
||||
SimpleTest.finish();
|
||||
for (var i = 0; i < gSeekTests.length; ++i) {
|
||||
var test = gSeekTests[i];
|
||||
var elemType = /^audio/.test(test.type) ? "audio" : "video";
|
||||
var v1 = document.createElement(elemType);
|
||||
if (!v1.canPlayType(test.type))
|
||||
continue;
|
||||
|
||||
v1.src = test.name;
|
||||
if (test.duration) {
|
||||
v1._expectedDuration = test.duration;
|
||||
}
|
||||
v1.addEventListener("loadedmetadata", function (event) {
|
||||
event.target.currentTime = event.target.duration;
|
||||
}, false);
|
||||
v1.addEventListener("ended", mediaEnded, false);
|
||||
v1.load();
|
||||
|
||||
++testsWaiting;
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
if (testsWaiting == 0) {
|
||||
todo(false, "Can't play anything");
|
||||
} else {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
<video src='seek.ogv' onloadeddata='start(event)' onended='didEnd(event)' controls></video>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -46,10 +46,10 @@ function doNextFile() {
|
|||
var name = test.name + " seek test " + i;
|
||||
var localIs = function(name) { return function(a, b, msg) {
|
||||
is(a, b, name + ": " + msg);
|
||||
}}();
|
||||
}}(name);
|
||||
var localOk = function(name) { return function(a, msg) {
|
||||
ok(a, name + ": " + msg);
|
||||
}}();
|
||||
}}(name);
|
||||
var localFinish = function() {
|
||||
--testsWaiting;
|
||||
if (testsWaiting == 0) {
|
||||
|
|
|
@ -695,11 +695,15 @@ nsWaveStateMachine::Run()
|
|||
// event, playback has not ended as far as the user's
|
||||
// concerned--the state machine needs to return to the last
|
||||
// playback state.
|
||||
// Special case #3: if seeking to the end of the media, transition
|
||||
// directly into STATE_ENDED.
|
||||
State nextState = mNextState;
|
||||
if (nextState == STATE_SEEKING) {
|
||||
nextState = STATE_PAUSED;
|
||||
} else if (nextState == STATE_ENDED) {
|
||||
nextState = mPaused ? STATE_PAUSED : STATE_PLAYING;
|
||||
} else if (GetDuration() == seekTime) {
|
||||
nextState = STATE_ENDED;
|
||||
}
|
||||
ChangeState(nextState);
|
||||
}
|
||||
|
@ -795,7 +799,8 @@ IsValidStateTransition(State aStartState, State aEndState)
|
|||
return PR_TRUE;
|
||||
break;
|
||||
case STATE_SEEKING:
|
||||
if (aEndState == STATE_PLAYING || aEndState == STATE_PAUSED)
|
||||
if (aEndState == STATE_PLAYING || aEndState == STATE_PAUSED ||
|
||||
aEndState == STATE_ENDED)
|
||||
return PR_TRUE;
|
||||
break;
|
||||
case STATE_PAUSED:
|
||||
|
|
Загрузка…
Ссылка в новой задаче