Bug 1235301 part 4 - webidl; r=ehsan draft
authorKaku Kuo <tkuo@mozilla.com>
Tue, 24 May 2016 23:05:59 +0800
changeset 372171 748fdc001a477ad5544a0102adc1ca8c82136b75
parent 372168 bce191db59199d25f79d954c9573512961b57afd
child 372172 42f33eaead486cdbef383efe4dd6db3066f82d06
push id19456
push usertkuo@mozilla.com
push dateFri, 27 May 2016 16:34:10 +0000
reviewersehsan
bugs1235301
milestone49.0a1
Bug 1235301 part 4 - webidl; r=ehsan Please refere to the comment in the HTMLMediaElement.webidl file for details. MozReview-Commit-ID: C0a6wpGx6yD
dom/webidl/HTMLMediaElement.webidl
modules/libpref/init/all.js
--- a/dom/webidl/HTMLMediaElement.webidl
+++ b/dom/webidl/HTMLMediaElement.webidl
@@ -174,8 +174,45 @@ partial interface HTMLMediaElement {
 partial interface HTMLMediaElement {
   [Pref="media.useAudioChannelService.testing"]
   readonly attribute double computedVolume;
   [Pref="media.useAudioChannelService.testing"]
   readonly attribute boolean computedMuted;
   [Pref="media.useAudioChannelService.testing"]
   readonly attribute unsigned long computedSuspended;
 };
+
+/*
+ * HTMLMediaElement::seekToNextFrame() is a Mozilla experimental feature.
+ *
+ * The SeekToNextFrame() method provides a way to access a video element's video
+ * frames one by one without going through the realtime playback. So, it lets
+ * authors use "frame" as unit to access the video element's underlying data,
+ * instead of "time".
+ *
+ * The SeekToNextFrame() is a kind of seek operation, so normally, once it is
+ * invoked, a "seeking" event is dispatched. However, if the media source has no
+ * video data or is not seekable, the operation is ignored without filing the
+ * "seeking" event.
+ *
+ * Once the SeekToNextFrame() is done, a "seeked" event should always be filed
+ * and a "ended" event might also be filed depends on where the media element's
+ * position before seeking was. There are two cases:
+ * Assume the media source has n+1 video frames where n is a non-negative
+ * integers and the frame sequence is indexed from zero.
+ * (1) If the currentTime is at anywhere smaller than the n-th frame's beginning
+ *     time, say the currentTime is now pointing to a position which is smaller
+ *     than the x-th frame's beginning time and larger or equal to the (x-1)-th
+ *     frame's beginning time, where x belongs to [1, n], then the
+ *     SeekToNextFrame() operation seeks the media to the x-th frame, sets the
+ *     media's currentTime to the x-th frame's beginning time and dispatches a
+ *     "seeked" event.
+ * (2) Otherwise, if the currentTime is larger or equal to the n-th frame's
+ *     beginning time, then the SeekToNextFrame() operation sets the media's
+ *     currentTime to the duration of the media source and dispatches a "seeked"
+ *     event and an "ended" event.
+ */
+partial interface HTMLMediaElement {
+  [Throws, Pref="media.seekToNextFrame.enabled"]
+  void seekToNextFrame(); // This API should be an asynchronous one which
+                          // returns a Promise<void>. Bug 1276272 follows this
+                          // issue.
+};
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5389,8 +5389,16 @@ pref("dom.mozBrowserFramesEnabled", fals
 pref("layout.css.color-adjust.enabled", true);
 
 // Disable Node.rootNode in release builds.
 #ifdef RELEASE_BUILD
 pref("dom.node.rootNode.enabled", false);
 #else
 pref("dom.node.rootNode.enabled", true);
 #endif
+
+// Once bug 1276272 is resolved, we will trun this preference to default ON in
+// non-release channels.
+#ifdef RELEASE_BUILD
+pref("media.seekToNextFrame.enabled", false);
+#else
+pref("media.seekToNextFrame.enabled", false);
+#endif