mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 23:23:33 +00:00
Bug 1208373 - Implement MediaStreamTrack's "ended" event and onended EventHandler. r=smaug,jib
MozReview-Commit-ID: DtqzY5nIdPI --HG-- extra : rebase_source : 37600d9e9090d5a72f3b85baedb075914d473568 extra : intermediate-source : 9c8e3a0dbff3d67d20e7637e9e9975c52e35764c extra : source : f6a237afe9a83a8389a8e0a4f7435da3c4d0ca54
This commit is contained in:
parent
81342d42f3
commit
416244b4cf
@ -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 ();
|
||||
|
Loading…
x
Reference in New Issue
Block a user