mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-27 20:25:44 +00:00
Bug 1295352 - Changed default MediaStreamPlayback.playMedia() to stop tracks afterwards. r=pehrsons
MozReview-Commit-ID: CjkRcALTY7V --HG-- extra : rebase_source : b240f23670aa08ff235fc663d9444fbf4e7b4721 extra : intermediate-source : d6ee39e75b5ac0c0108a79d6a0b4ce5d7ae83eff extra : source : f0a1407718aa20927de2a74da20e6073537958e8
This commit is contained in:
parent
ced0c540e3
commit
33cd327d9f
@ -32,11 +32,11 @@ MediaStreamPlayback.prototype = {
|
||||
* @param {Boolean} isResume specifies if this media element is being resumed
|
||||
* from a previous run
|
||||
*/
|
||||
playMediaWithMediaStreamTracksStop : function(isResume) {
|
||||
playMedia : function(isResume) {
|
||||
this.startMedia(isResume);
|
||||
return this.verifyPlaying()
|
||||
.then(() => this.stopTracksForStreamInMediaPlayback())
|
||||
.then(() => this.stopMediaElement());
|
||||
.then(() => this.detachFromMediaElement());
|
||||
},
|
||||
|
||||
/**
|
||||
@ -80,15 +80,15 @@ MediaStreamPlayback.prototype = {
|
||||
|
||||
/**
|
||||
* Starts media with a media stream, runs it until a canplaythrough and
|
||||
* timeupdate event fires, and stops the media.
|
||||
* timeupdate event fires, and detaches from the element without stopping media.
|
||||
*
|
||||
* @param {Boolean} isResume specifies if this media element is being resumed
|
||||
* from a previous run
|
||||
*/
|
||||
playMedia : function(isResume) {
|
||||
playMediaWithoutStoppingTracks : function(isResume) {
|
||||
this.startMedia(isResume);
|
||||
return this.verifyPlaying()
|
||||
.then(() => this.stopMediaElement());
|
||||
.then(() => this.detachFromMediaElement());
|
||||
},
|
||||
|
||||
/**
|
||||
@ -156,12 +156,12 @@ MediaStreamPlayback.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Stops the media with the associated stream.
|
||||
* Detaches from the element without stopping the media.
|
||||
*
|
||||
* Precondition: The media stream and element should both be actively
|
||||
* being played.
|
||||
*/
|
||||
stopMediaElement : function() {
|
||||
detachFromMediaElement : function() {
|
||||
this.mediaElement.pause();
|
||||
this.mediaElement.srcObject = null;
|
||||
}
|
||||
@ -198,7 +198,7 @@ LocalMediaStreamPlayback.prototype = Object.create(MediaStreamPlayback.prototype
|
||||
this.startMedia(isResume);
|
||||
return this.verifyPlaying()
|
||||
.then(() => this.deprecatedStopStreamInMediaPlayback())
|
||||
.then(() => this.stopMediaElement());
|
||||
.then(() => this.detachFromMediaElement());
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
var testElem = createMediaElement('video', 'testAddTrackAudioVideo');
|
||||
var playback = new LocalMediaStreamPlayback(testElem, stream);
|
||||
return playback.playMediaWithMediaStreamTracksStop(false);
|
||||
return playback.playMedia(false);
|
||||
}))
|
||||
.then(() => getUserMedia({video: true})).then(stream =>
|
||||
getUserMedia({video: true}).then(otherStream => {
|
||||
@ -44,7 +44,7 @@
|
||||
|
||||
var test = createMediaElement('video', 'testAddTrackDoubleVideo');
|
||||
var playback = new LocalMediaStreamPlayback(test, stream);
|
||||
return playback.playMediaWithMediaStreamTracksStop(false);
|
||||
return playback.playMedia(false);
|
||||
}))
|
||||
.then(() => getUserMedia({video: true})).then(stream =>
|
||||
getUserMedia({video: true}).then(otherStream => {
|
||||
@ -81,7 +81,7 @@
|
||||
stream.addTrack(track);
|
||||
checkMediaStreamContains(stream, [track], "Re-added added-then-removed track");
|
||||
var playback = new LocalMediaStreamPlayback(elem, stream);
|
||||
return playback.playMediaWithMediaStreamTracksStop(false);
|
||||
return playback.playMedia(false);
|
||||
})
|
||||
.then(() => otherTrack.stop());
|
||||
}))
|
||||
@ -99,7 +99,7 @@
|
||||
|
||||
var elem = createMediaElement('video', 'testAddRemoveOriginalTrackVideo');
|
||||
var playback = new LocalMediaStreamPlayback(elem, audioStream);
|
||||
return playback.playMediaWithMediaStreamTracksStop(false);
|
||||
return playback.playMedia(false);
|
||||
}))
|
||||
.then(() => {
|
||||
var ac = new AudioContext();
|
||||
|
@ -87,7 +87,7 @@
|
||||
]))
|
||||
.then(() => playback.verifyPlaying()) // still playing
|
||||
.then(() => playback.deprecatedStopStreamInMediaPlayback())
|
||||
.then(() => playback.stopMediaElement());
|
||||
.then(() => playback.detachFromMediaElement());
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -60,7 +60,7 @@
|
||||
]))
|
||||
.then(() => playback.verifyPlaying()) // still playing
|
||||
.then(() => playback.deprecatedStopStreamInMediaPlayback())
|
||||
.then(() => playback.stopMediaElement());
|
||||
.then(() => playback.detachFromMediaElement());
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
info("Playing from track clones");
|
||||
var test = createMediaElement('video', 'testClonePlayback');
|
||||
var playback = new MediaStreamPlayback(test, clone);
|
||||
return playback.playMediaWithMediaStreamTracksStop(false);
|
||||
return playback.playMedia(false);
|
||||
})
|
||||
.then(() => getUserMedia({video: true})).then(stream =>
|
||||
getUserMedia({video: true}).then(otherStream => {
|
||||
@ -67,7 +67,7 @@
|
||||
|
||||
var test = createMediaElement('video', 'testClonePlayback');
|
||||
var playback = new MediaStreamPlayback(test, streamClone);
|
||||
return playback.playMediaWithMediaStreamTracksStop(false)
|
||||
return playback.playMedia(false)
|
||||
.then(() => stream.getTracks().forEach(t => t.stop()))
|
||||
.then(() => stream.stop());
|
||||
}))
|
||||
@ -85,7 +85,7 @@
|
||||
|
||||
var test = createMediaElement('video', 'testClonePlayback');
|
||||
var playback = new MediaStreamPlayback(test, inceptionClone);
|
||||
return playback.playMediaWithMediaStreamTracksStop(false);
|
||||
return playback.playMedia(false);
|
||||
})
|
||||
.then(() => getUserMedia({audio: true, video: true})).then(stream => {
|
||||
info("Test adding tracks from many stream clones to the original stream");
|
||||
@ -105,7 +105,7 @@
|
||||
|
||||
var test = createMediaElement('video', 'testClonePlayback');
|
||||
var playback = new MediaStreamPlayback(test, stream);
|
||||
return playback.playMediaWithMediaStreamTracksStop(false);
|
||||
return playback.playMedia(false);
|
||||
})
|
||||
.then(() => {
|
||||
info("Testing audio content routing with MediaStream.clone()");
|
||||
|
@ -31,7 +31,7 @@
|
||||
info("Testing playback of track clone");
|
||||
var test = createMediaElement('video', 'testClonePlayback');
|
||||
var playback = new MediaStreamPlayback(test, cloneStream);
|
||||
return playback.playMediaWithMediaStreamTracksStop(false);
|
||||
return playback.playMedia(false);
|
||||
});
|
||||
|
||||
runTest(() => Promise.resolve()
|
||||
@ -52,7 +52,7 @@
|
||||
|
||||
var test = createMediaElement('video', 'testClonePlayback');
|
||||
var playback = new MediaStreamPlayback(test, cloneStream);
|
||||
return playback.playMediaWithMediaStreamTracksStop(false)
|
||||
return playback.playMedia(false)
|
||||
.then(() => info("Testing that clones of ended tracks are ended"))
|
||||
.then(() => cloneStream.clone().getTracks().forEach(t =>
|
||||
is(t.readyState, "ended", "Track " + t.id + " should be ended")));
|
||||
@ -73,7 +73,7 @@
|
||||
|
||||
var test = createMediaElement('video', 'testClonePlayback');
|
||||
var playback = new MediaStreamPlayback(test, stream);
|
||||
return playback.playMediaWithMediaStreamTracksStop(false);
|
||||
return playback.playMedia(false);
|
||||
})
|
||||
.then(() => {
|
||||
info("Testing audio content routing with MediaStreamTrack.clone()");
|
||||
|
Loading…
Reference in New Issue
Block a user