зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1208373 - Implement MediaStreamTrack's "ended" event and onended EventHandler. r=smaug,jib
MozReview-Commit-ID: DtqzY5nIdPI --HG-- extra : rebase_source : e236f799c05de0bef9c9d1248e4a6db2e0ae7f31 extra : source : f6a237afe9a83a8389a8e0a4f7435da3c4d0ca54
This commit is contained in:
Родитель
ba8b7f91e2
Коммит
e86ac0c2b2
|
@ -350,6 +350,22 @@ MediaStreamTrack::Clone()
|
|||
return newStream->CloneDOMTrack(*this, mTrackID);
|
||||
}
|
||||
|
||||
void
|
||||
MediaStreamTrack::NotifyEnded()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (mEnded) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(LogLevel::Info, ("MediaStreamTrack %p ended", this));
|
||||
|
||||
mEnded = true;
|
||||
|
||||
DispatchTrustedEvent(NS_LITERAL_STRING("ended"));
|
||||
}
|
||||
|
||||
DOMMediaStream*
|
||||
MediaStreamTrack::GetInputDOMStream()
|
||||
{
|
||||
|
|
|
@ -267,9 +267,18 @@ public:
|
|||
ApplyConstraints(const dom::MediaTrackConstraints& aConstraints, ErrorResult &aRv);
|
||||
already_AddRefed<MediaStreamTrack> Clone();
|
||||
|
||||
IMPL_EVENT_HANDLER(ended)
|
||||
|
||||
bool Ended() const { return mEnded; }
|
||||
// Notifications from the MediaStreamGraph
|
||||
void NotifyEnded() { mEnded = true; }
|
||||
|
||||
/**
|
||||
* Notified by the MediaStreamGraph, through our owning MediaStream on the
|
||||
* main thread.
|
||||
*
|
||||
* Note that this sets the track to ended and raises the "ended" event
|
||||
* synchronously.
|
||||
*/
|
||||
void NotifyEnded();
|
||||
|
||||
/**
|
||||
* Get this track's principal.
|
||||
|
|
|
@ -75,7 +75,7 @@ interface MediaStreamTrack : EventTarget {
|
|||
// readonly attribute boolean _readonly;
|
||||
// readonly attribute boolean remote;
|
||||
// readonly attribute MediaStreamTrackState readyState;
|
||||
// attribute EventHandler onended;
|
||||
attribute EventHandler onended;
|
||||
MediaStreamTrack clone ();
|
||||
void stop ();
|
||||
// MediaTrackCapabilities getCapabilities ();
|
||||
|
|
Загрузка…
Ссылка в новой задаче