[Modern Media Controls] MediaControls base class
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Oct 2016 19:02:29 +0000 (19:02 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Oct 2016 19:02:29 +0000 (19:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=163387
<rdar://problem/28753955>

Patch by Antoine Quint <graouts@apple.com> on 2016-10-13
Reviewed by Dean Jackson.

Source/WebCore:

Introducing the new MediaControls class which will serve as a basis for all media controls.
We will introduce specific MediaControls subclasses for macOS inline, macOS fullscreen and
iOS inline in future patches.

Tests: media/modern-media-controls/media-controls/media-controls-constructor.html
       media/modern-media-controls/media-controls/media-controls-placard.html
       media/modern-media-controls/media-controls/media-controls-start-button.html

* Modules/modern-media-controls/controls/media-controls.css: Added.
(.media-controls,):
* Modules/modern-media-controls/controls/media-controls.js: Added.
(MediaControls.):
(MediaControls.prototype.get showsStartButton):
(MediaControls.prototype.set showsStartButton):
(MediaControls.prototype.get showsPlacard):
(MediaControls.prototype.showPlacard):
(MediaControls.prototype.hidePlacard):

LayoutTests:

Testing the properties of the new MediaControls class.

* media/modern-media-controls/media-controls/media-controls-constructor-expected.txt: Added.
* media/modern-media-controls/media-controls/media-controls-constructor.html: Added.
* media/modern-media-controls/media-controls/media-controls-placard-expected.txt: Added.
* media/modern-media-controls/media-controls/media-controls-placard.html: Added.
* media/modern-media-controls/media-controls/media-controls-start-button-expected.txt: Added.
* media/modern-media-controls/media-controls/media-controls-start-button.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207299 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/media/modern-media-controls/media-controls/media-controls-constructor-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/media-controls/media-controls-constructor.html [new file with mode: 0644]
LayoutTests/media/modern-media-controls/media-controls/media-controls-placard-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/media-controls/media-controls-placard.html [new file with mode: 0644]
LayoutTests/media/modern-media-controls/media-controls/media-controls-start-button-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/media-controls/media-controls-start-button.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/modern-media-controls/controls/media-controls.css [new file with mode: 0644]
Source/WebCore/Modules/modern-media-controls/controls/media-controls.js [new file with mode: 0644]

index d847c0b..77e2d07 100644 (file)
@@ -1,5 +1,22 @@
 2016-10-13  Antoine Quint  <graouts@apple.com>
 
+        [Modern Media Controls] MediaControls base class
+        https://bugs.webkit.org/show_bug.cgi?id=163387
+        <rdar://problem/28753955>
+
+        Reviewed by Dean Jackson.
+
+        Testing the properties of the new MediaControls class.
+
+        * media/modern-media-controls/media-controls/media-controls-constructor-expected.txt: Added.
+        * media/modern-media-controls/media-controls/media-controls-constructor.html: Added.
+        * media/modern-media-controls/media-controls/media-controls-placard-expected.txt: Added.
+        * media/modern-media-controls/media-controls/media-controls-placard.html: Added.
+        * media/modern-media-controls/media-controls/media-controls-start-button-expected.txt: Added.
+        * media/modern-media-controls/media-controls/media-controls-start-button.html: Added.
+
+2016-10-13  Antoine Quint  <graouts@apple.com>
+
         [Modern Media Controls] TimeControl and TimeLabel
         https://bugs.webkit.org/show_bug.cgi?id=163356
         <rdar://problem/28741376>
diff --git a/LayoutTests/media/modern-media-controls/media-controls/media-controls-constructor-expected.txt b/LayoutTests/media/modern-media-controls/media-controls/media-controls-constructor-expected.txt
new file mode 100644 (file)
index 0000000..cb567be
--- /dev/null
@@ -0,0 +1,34 @@
+Testing the MediaControls constructor.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS mediaControls.element.localName is "div"
+PASS mediaControls.element.className is "media-controls"
+
+PASS mediaControls.width is 300
+PASS mediaControls.height is 150
+PASS mediaControls.layoutTraits is LayoutTraits.macOS
+PASS mediaControls.showsStartButton is false
+
+PASS mediaControls.startButton instanceof StartButton is true
+PASS mediaControls.playPauseButton instanceof PlayPauseButton is true
+PASS mediaControls.skipBackButton instanceof SkipBackButton is true
+PASS mediaControls.airplayButton instanceof AirplayButton is true
+PASS mediaControls.pipButton instanceof PiPButton is true
+PASS mediaControls.fullscreenButton instanceof FullscreenButton is true
+PASS mediaControls.timeControl instanceof TimeControl is true
+PASS mediaControls.airplayPlacard instanceof AirplayPlacard is true
+PASS mediaControls.pipPlacard instanceof PiPPlacard is true
+
+PASS mediaControls.controlsBar instanceof LayoutItem is true
+PASS mediaControls.controlsBar.element.localName is "div"
+PASS mediaControls.controlsBar.element.className is "controls-bar"
+
+PASS mediaControlsWithArguments.width is 600
+PASS mediaControlsWithArguments.height is 300
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/media/modern-media-controls/media-controls/media-controls-constructor.html b/LayoutTests/media/modern-media-controls/media-controls/media-controls-constructor.html
new file mode 100644 (file)
index 0000000..669d288
--- /dev/null
@@ -0,0 +1,65 @@
+<script src="../../../resources/js-test-pre.js"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/scheduler.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/layout-node.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/layout-item.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/icon-service.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/start-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/icon-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/play-pause-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/skip-back-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/airplay-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/pip-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/fullscreen-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/slider.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/scrubber.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/time-label.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/time-control.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/placard.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/airplay-placard.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/pip-placard.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/media-controls.js" type="text/javascript"></script>
+<body>
+<script type="text/javascript">
+
+description("Testing the <code>MediaControls</code> constructor.");
+
+iconService.directoryPath = "../../../../Source/WebCore/Modules/modern-media-controls/images";
+
+const mediaControls = new MediaControls({ layoutTraits: LayoutTraits.macOS });
+
+shouldBeEqualToString("mediaControls.element.localName", "div");
+shouldBeEqualToString("mediaControls.element.className", "media-controls");
+
+debug("");
+shouldBe("mediaControls.width", "300");
+shouldBe("mediaControls.height", "150");
+shouldBe("mediaControls.layoutTraits", "LayoutTraits.macOS");
+shouldBeFalse("mediaControls.showsStartButton");
+
+debug("");
+shouldBeTrue("mediaControls.startButton instanceof StartButton");
+shouldBeTrue("mediaControls.playPauseButton instanceof PlayPauseButton");
+shouldBeTrue("mediaControls.skipBackButton instanceof SkipBackButton");
+shouldBeTrue("mediaControls.airplayButton instanceof AirplayButton");
+shouldBeTrue("mediaControls.pipButton instanceof PiPButton");
+shouldBeTrue("mediaControls.fullscreenButton instanceof FullscreenButton");
+shouldBeTrue("mediaControls.timeControl instanceof TimeControl");
+shouldBeTrue("mediaControls.airplayPlacard instanceof AirplayPlacard");
+shouldBeTrue("mediaControls.pipPlacard instanceof PiPPlacard");
+
+debug("");
+shouldBeTrue("mediaControls.controlsBar instanceof LayoutItem");
+shouldBeEqualToString("mediaControls.controlsBar.element.localName", "div");
+shouldBeEqualToString("mediaControls.controlsBar.element.className", "controls-bar");
+
+debug("");
+const mediaControlsWithArguments = new MediaControls({ width: 600, height: 300, layoutTraits: LayoutTraits.macOS });
+shouldBe("mediaControlsWithArguments.width", "600");
+shouldBe("mediaControlsWithArguments.height", "300");
+
+debug("");
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
diff --git a/LayoutTests/media/modern-media-controls/media-controls/media-controls-placard-expected.txt b/LayoutTests/media/modern-media-controls/media-controls/media-controls-placard-expected.txt
new file mode 100644 (file)
index 0000000..0489f76
--- /dev/null
@@ -0,0 +1,25 @@
+Testing the MediaControls handling of placards.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+By default, no placard is shown.
+PASS mediaControls.showsPlacard is false
+PASS mediaControls.children is [mediaControls.controlsBar]
+
+Showing the Airplay placard
+PASS mediaControls.showsPlacard is true
+PASS mediaControls.children is [mediaControls.airplayPlacard, mediaControls.controlsBar]
+
+Showing the PiP placard, hides the controls bar
+PASS mediaControls.showsPlacard is true
+PASS mediaControls.children is [mediaControls.pipPlacard]
+
+Hide placard
+PASS mediaControls.showsPlacard is false
+PASS mediaControls.children is [mediaControls.controlsBar]
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/media/modern-media-controls/media-controls/media-controls-placard.html b/LayoutTests/media/modern-media-controls/media-controls/media-controls-placard.html
new file mode 100644 (file)
index 0000000..7e316af
--- /dev/null
@@ -0,0 +1,57 @@
+<script src="../../../resources/js-test-pre.js"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/scheduler.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/layout-node.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/layout-item.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/icon-service.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/start-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/icon-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/play-pause-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/skip-back-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/airplay-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/pip-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/fullscreen-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/slider.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/scrubber.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/time-label.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/time-control.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/placard.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/airplay-placard.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/pip-placard.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/media-controls.js" type="text/javascript"></script>
+<body>
+<script type="text/javascript">
+
+description("Testing the <code>MediaControls</code> handling of placards.");
+
+iconService.directoryPath = "../../../../Source/WebCore/Modules/modern-media-controls/images";
+
+const mediaControls = new MediaControls({ layoutTraits: LayoutTraits.macOS });
+
+debug("By default, no placard is shown.");
+shouldBeFalse("mediaControls.showsPlacard");
+shouldBe("mediaControls.children", "[mediaControls.controlsBar]");
+
+debug("");
+debug("Showing the Airplay placard");
+mediaControls.showPlacard(mediaControls.airplayPlacard);
+shouldBeTrue("mediaControls.showsPlacard");
+shouldBe("mediaControls.children", "[mediaControls.airplayPlacard, mediaControls.controlsBar]");
+
+debug("");
+debug("Showing the PiP placard, hides the controls bar");
+mediaControls.showPlacard(mediaControls.pipPlacard);
+shouldBeTrue("mediaControls.showsPlacard");
+shouldBe("mediaControls.children", "[mediaControls.pipPlacard]");
+
+debug("");
+debug("Hide placard");
+mediaControls.hidePlacard();
+shouldBeFalse("mediaControls.showsPlacard");
+shouldBe("mediaControls.children", "[mediaControls.controlsBar]");
+
+debug("");
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
diff --git a/LayoutTests/media/modern-media-controls/media-controls/media-controls-start-button-expected.txt b/LayoutTests/media/modern-media-controls/media-controls/media-controls-start-button-expected.txt
new file mode 100644 (file)
index 0000000..bacab05
--- /dev/null
@@ -0,0 +1,17 @@
+Testing the MediaControls showsStartButton property.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Default where showsStartButton = false
+PASS mediaControls.showsStartButton is false
+PASS mediaControls.children is [mediaControls.controlsBar]
+
+showsStartButton = true
+PASS mediaControls.showsStartButton is true
+PASS mediaControls.children is [mediaControls.startButton]
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/media/modern-media-controls/media-controls/media-controls-start-button.html b/LayoutTests/media/modern-media-controls/media-controls/media-controls-start-button.html
new file mode 100644 (file)
index 0000000..a66de63
--- /dev/null
@@ -0,0 +1,45 @@
+<script src="../../../resources/js-test-pre.js"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/scheduler.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/layout-node.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/layout-item.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/icon-service.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/start-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/icon-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/play-pause-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/skip-back-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/airplay-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/pip-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/fullscreen-button.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/slider.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/scrubber.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/time-label.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/time-control.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/placard.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/airplay-placard.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/pip-placard.js" type="text/javascript"></script>
+<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/media-controls.js" type="text/javascript"></script>
+<body>
+<script type="text/javascript">
+
+description("Testing the <code>MediaControls</code> showsStartButton property.");
+
+iconService.directoryPath = "../../../../Source/WebCore/Modules/modern-media-controls/images";
+
+const mediaControls = new MediaControls({ layoutTraits: LayoutTraits.macOS });
+
+debug("Default where showsStartButton = false");
+shouldBeFalse("mediaControls.showsStartButton");
+shouldBe("mediaControls.children", "[mediaControls.controlsBar]");
+
+debug("");
+debug("showsStartButton = true");
+mediaControls.showsStartButton = true;
+shouldBeTrue("mediaControls.showsStartButton");
+shouldBe("mediaControls.children", "[mediaControls.startButton]");
+
+debug("");
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
index feed612..0ce12de 100644 (file)
@@ -1,3 +1,29 @@
+2016-10-13  Antoine Quint  <graouts@apple.com>
+
+        [Modern Media Controls] MediaControls base class
+        https://bugs.webkit.org/show_bug.cgi?id=163387
+        <rdar://problem/28753955>
+
+        Reviewed by Dean Jackson.
+
+        Introducing the new MediaControls class which will serve as a basis for all media controls.
+        We will introduce specific MediaControls subclasses for macOS inline, macOS fullscreen and
+        iOS inline in future patches.
+
+        Tests: media/modern-media-controls/media-controls/media-controls-constructor.html
+               media/modern-media-controls/media-controls/media-controls-placard.html
+               media/modern-media-controls/media-controls/media-controls-start-button.html
+
+        * Modules/modern-media-controls/controls/media-controls.css: Added.
+        (.media-controls,):
+        * Modules/modern-media-controls/controls/media-controls.js: Added.
+        (MediaControls.):
+        (MediaControls.prototype.get showsStartButton):
+        (MediaControls.prototype.set showsStartButton):
+        (MediaControls.prototype.get showsPlacard):
+        (MediaControls.prototype.showPlacard):
+        (MediaControls.prototype.hidePlacard):
+
 2016-10-13  Alex Christensen  <achristensen@webkit.org>
 
         Disable URLParser for non-Safari iOS and Mac apps for now
diff --git a/Source/WebCore/Modules/modern-media-controls/controls/media-controls.css b/Source/WebCore/Modules/modern-media-controls/controls/media-controls.css
new file mode 100644 (file)
index 0000000..dbd0448
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+.media-controls,
+.media-controls > .controls-bar {
+    position: absolute;
+}
diff --git a/Source/WebCore/Modules/modern-media-controls/controls/media-controls.js b/Source/WebCore/Modules/modern-media-controls/controls/media-controls.js
new file mode 100644 (file)
index 0000000..5b84848
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+class MediaControls extends LayoutNode
+{
+
+    constructor({ width = 300, height = 150, layoutTraits = LayoutTraits.Unknown } = {})
+    {
+        super(`<div class="media-controls">`);
+
+        this.width = width;
+        this.height = height;
+        this.layoutTraits = layoutTraits;
+
+        this.startButton = new StartButton(this);
+
+        this.playPauseButton = new PlayPauseButton(this);
+        this.skipBackButton = new SkipBackButton(this);
+        this.airplayButton = new AirplayButton(this);
+        this.pipButton = new PiPButton(this);
+        this.fullscreenButton = new FullscreenButton(this);
+
+        this.timeControl = new TimeControl(this);
+
+        this.controlsBar = new LayoutItem({
+            element: `<div class="controls-bar">`,
+            layoutDelegate: this
+        });
+
+        this.airplayPlacard = new AirplayPlacard(this);
+        this.pipPlacard = new PiPPlacard(this);
+
+        this.showsStartButton = false;
+    }
+
+    // Public
+
+    get showsStartButton()
+    {
+        return this.children.includes(this.startButton);
+    }
+
+    set showsStartButton(showsStartButton)
+    {
+        this.children = [showsStartButton ? this.startButton : this.controlsBar];
+    }
+
+    get showsPlacard()
+    {
+        return this.children.includes(this.airplayPlacard) || this.children.includes(this.pipPlacard);
+    }
+
+    showPlacard(placard)
+    {
+        const children = [placard];
+        if (placard === this.airplayPlacard)
+            children.push(this.controlsBar);
+
+        this.children = children;
+    }
+
+    hidePlacard()
+    {
+        this.children = [this.controlsBar];
+    }
+
+}