-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from THEOplayer/rework-settings-menu
Rework settings menu
- Loading branch information
Showing
17 changed files
with
145 additions
and
73 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { StateReceiverMixin } from './StateReceiverMixin'; | ||
import { setTextContent } from '../util/CommonUtils'; | ||
import * as shadyCss from '@webcomponents/shadycss'; | ||
|
||
/** | ||
* @group Components | ||
*/ | ||
export class PlaybackRateDisplay extends StateReceiverMixin(HTMLElement, ['playbackRate']) { | ||
private readonly _spanEl: HTMLSpanElement; | ||
private _playbackRate: number = 1; | ||
|
||
constructor() { | ||
super(); | ||
const shadowRoot = this.attachShadow({ mode: 'open' }); | ||
this._spanEl = document.createElement('span'); | ||
shadowRoot.appendChild(this._spanEl); | ||
|
||
this._upgradeProperty('playbackRate'); | ||
} | ||
|
||
connectedCallback(): void { | ||
shadyCss.styleElement(this); | ||
} | ||
|
||
protected _upgradeProperty(prop: keyof this) { | ||
if (this.hasOwnProperty(prop)) { | ||
let value = this[prop]; | ||
delete this[prop]; | ||
this[prop] = value; | ||
} | ||
} | ||
|
||
get playbackRate(): number { | ||
return this._playbackRate; | ||
} | ||
|
||
set playbackRate(value: number) { | ||
this._playbackRate = value; | ||
setTextContent(this._spanEl, value === 1 ? 'Normal' : `${value}x`); | ||
} | ||
} | ||
|
||
customElements.define('theoplayer-playback-rate-display', PlaybackRateDisplay); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<theoplayer-playback-rate-radio-group> | ||
<theoplayer-radio-button value="0.25">0.25x</theoplayer-radio-button> | ||
<theoplayer-radio-button value="0.5">0.5x</theoplayer-radio-button> | ||
<theoplayer-radio-button value="1">Normal</theoplayer-radio-button> | ||
<theoplayer-radio-button value="1.25">1.25x</theoplayer-radio-button> | ||
<theoplayer-radio-button value="1.5">1.5x</theoplayer-radio-button> | ||
<theoplayer-radio-button value="2">2x</theoplayer-radio-button> | ||
</theoplayer-playback-rate-radio-group> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as shadyCss from '@webcomponents/shadycss'; | ||
import { Menu, menuTemplate } from './Menu'; | ||
import playbackRateMenuHtml from './PlaybackRateMenu.html'; | ||
import './PlaybackRateRadioGroup'; | ||
|
||
const template = document.createElement('template'); | ||
template.innerHTML = menuTemplate(`<span slot="heading"><slot name="heading">Playback speed</slot></span>`, playbackRateMenuHtml); | ||
shadyCss.prepareTemplate(template, 'theoplayer-playback-rate-menu'); | ||
|
||
/** | ||
* A menu to change the playback rate of the player. | ||
* | ||
* @group Components | ||
*/ | ||
export class PlaybackRateMenu extends Menu { | ||
constructor() { | ||
super({ template }); | ||
} | ||
} | ||
|
||
customElements.define('theoplayer-playback-rate-menu', PlaybackRateMenu); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
.theoplayer-text-track-style-menu span { | ||
.theoplayer-menu-heading { | ||
flex-grow: 1; | ||
} | ||
|
||
.theoplayer-text-track-style-menu theoplayer-text-track-style-reset-button { | ||
.theoplayer-menu-heading-button { | ||
align-self: flex-end; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.