mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-26 17:46:26 +03:00
64896d70b0
This reflects changes in Google's policy on JavaScript license headers, which should be smaller to avoid increasing the size of the binary unnecessarily. This also updates the company name from "Google, Inc" to "Google LLC". Change-Id: I3f8b9ed3700b6351f43173d50c94d35c333e82b4
52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
/** @license
|
|
* Copyright 2016 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
|
|
goog.provide('shakaDemo.CloseButton');
|
|
|
|
|
|
/**
|
|
* A custom UI button, to allow users to close the video element.
|
|
* This cannot actually extend shaka.ui.Element, as that class does not exist
|
|
* at load-time when in uncompiled mode.
|
|
* @extends {shaka.ui.Element}
|
|
*/
|
|
shakaDemo.CloseButton = class extends shaka.ui.Element {
|
|
/**
|
|
* @param {!HTMLElement} parent
|
|
* @param {!shaka.ui.Controls} controls
|
|
*/
|
|
constructor(parent, controls) {
|
|
super(parent, controls);
|
|
this.button_ = document.createElement('button');
|
|
this.button_.classList.add('material-icons');
|
|
this.button_.classList.add('close-button');
|
|
this.button_.textContent = 'close'; // Close icon.
|
|
this.parent.appendChild(this.button_);
|
|
|
|
this.button_.addEventListener('click', () => {
|
|
shakaDemoMain.unload();
|
|
});
|
|
|
|
// TODO: Make sure that the screenreader description of this control is
|
|
// localized!
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @implements {shaka.extern.IUIElement.Factory}
|
|
* @final
|
|
*/
|
|
shakaDemo.CloseButton.Factory = class {
|
|
/** @override */
|
|
create(rootElement, controls) {
|
|
return new shakaDemo.CloseButton(rootElement, controls);
|
|
}
|
|
};
|
|
|
|
// This button is registered inside setup in shakaDemo.Main, rather than
|
|
// statically here, since shaka.ui.Controls does not exist in this stage of the
|
|
// load process.
|