Bug 1021969, r=bholley,jaws

--HG--
extra : rebase_source : f8bc835a5bfcd62e1d59b31d75841d1cc6339634
This commit is contained in:
Gijs Kruitbosch 2014-06-06 17:33:50 +01:00
parent 28a5e23304
commit ee2a420fc8
5 changed files with 22 additions and 6 deletions

View File

@ -445,7 +445,7 @@ nsContextMenu.prototype = {
this.showItem("context-media-showcontrols", onMedia && !this.target.controls);
this.showItem("context-media-hidecontrols", onMedia && this.target.controls);
this.showItem("context-video-fullscreen", this.onVideo && this.target.ownerDocument.mozFullScreenElement == null);
var statsShowing = this.onVideo && XPCNativeWrapper.unwrap(this.target).mozMediaStatisticsShowing;
var statsShowing = this.onVideo && this.target.mozMediaStatisticsShowing;
this.showItem("context-video-showstats", this.onVideo && this.target.controls && !statsShowing);
this.showItem("context-video-hidestats", this.onVideo && this.target.controls && statsShowing);

View File

@ -478,6 +478,16 @@ public:
SetHTMLBoolAttr(nsGkAtoms::muted, aMuted, aRv);
}
bool MozMediaStatisticsShowing() const
{
return mStatsShowing;
}
void SetMozMediaStatisticsShowing(bool aShow)
{
mStatsShowing = aShow;
}
already_AddRefed<DOMMediaStream> GetMozSrcObject() const;
void SetMozSrcObject(DOMMediaStream& aValue);
@ -1078,6 +1088,10 @@ protected:
uint32_t mMuted;
// True if the media statistics are currently being shown by the builtin
// video controls
bool mStatsShowing;
// True if the sound is being captured.
bool mAudioCaptured;

View File

@ -1987,6 +1987,7 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed<nsINodeInfo>& aNodeInfo)
mLoadedFirstFrame(false),
mAutoplaying(true),
mAutoplayEnabled(true),
mStatsShowing(false),
mPaused(true),
mMuted(0),
mAudioCaptured(false),

View File

@ -102,6 +102,9 @@ partial interface HTMLMediaElement {
attribute boolean mozPreservesPitch;
readonly attribute boolean mozAutoplayEnabled;
// NB: for internal use with the video controls:
[Func="IsChromeOrXBL"] attribute boolean mozMediaStatisticsShowing;
// Mozilla extension: stream capture
[Throws]
MediaStream mozCaptureStream();

View File

@ -477,7 +477,7 @@
this.adjustControlSize();
// Preserve Statistics when toggling fullscreen mode due to bug 714071.
if (XPCNativeWrapper.unwrap(this.video).mozMediaStatisticsShowing)
if (this.video.mozMediaStatisticsShowing)
this.showStatistics(true);
this._handleCustomEventsBound = this.handleCustomEvents.bind(this);
@ -1152,15 +1152,13 @@
this.statsInterval = null;
}
let unwrappedVideo = XPCNativeWrapper.unwrap(this.video);
if (shouldShow) {
unwrappedVideo.mozMediaStatisticsShowing = true;
this.video.mozMediaStatisticsShowing = true;
this.statsOverlay.hidden = false;
this.statsInterval = setInterval(this.updateStats.bind(this), this.STATS_INTERVAL_MS);
this.updateStats();
} else {
delete unwrappedVideo.mozMediaStatisticsShowing;
this.video.mozMediaStatisticsShowing = false;
this.statsOverlay.hidden = true;
}
},