|
1 | 1 | import * as shadyCss from '@webcomponents/shadycss'; |
2 | | -import { ChromelessPlayer, type MediaTrack, type PlayerConfiguration, type SourceDescription, type VideoQuality } from 'theoplayer/chromeless'; |
| 2 | +import { ChromelessPlayer, type MediaTrack, type SourceDescription, type UIPlayerConfiguration, type VideoQuality } from 'theoplayer/chromeless'; |
3 | 3 | import elementCss from './UIContainer.css'; |
4 | 4 | import elementHtml from './UIContainer.html'; |
5 | 5 | import { |
@@ -70,7 +70,7 @@ const FULL_WINDOW_ROOT_CLASS = 'theoplayer-ui-full-window'; |
70 | 70 | * |
71 | 71 | * The styling can be controlled using CSS custom properties (see below). |
72 | 72 | * |
73 | | - * @attribute `configuration` - The THEOplayer {@link theoplayer!PlayerConfiguration | PlayerConfiguration}, as a JSON string. |
| 73 | + * @attribute `configuration` - The THEOplayer {@link theoplayer!UIPlayerConfiguration | UIPlayerConfiguration}, as a JSON string. |
74 | 74 | * @attribute `source` - The THEOplayer {@link theoplayer!SourceDescription | SourceDescription}, as a JSON string. |
75 | 75 | * @attribute `fluid` - If set, the player automatically adjusts its height to fit the video's aspect ratio. |
76 | 76 | * @attribute `muted` - If set, the player starts out as muted. Reflects `ui.player.muted`. |
@@ -143,7 +143,7 @@ export class UIContainer extends HTMLElement { |
143 | 143 | ]; |
144 | 144 | } |
145 | 145 |
|
146 | | - private _configuration: PlayerConfiguration = {}; |
| 146 | + private _configuration: UIPlayerConfiguration = {}; |
147 | 147 | private readonly _playerEl: HTMLElement; |
148 | 148 | private readonly _menuEl: HTMLElement; |
149 | 149 | private readonly _menuGroup: MenuGroup; |
@@ -172,7 +172,7 @@ export class UIContainer extends HTMLElement { |
172 | 172 | * the underlying THEOplayer instance. |
173 | 173 | * Can also be set later on through the {@link UIContainer.configuration} property. |
174 | 174 | */ |
175 | | - constructor(configuration: PlayerConfiguration = {}) { |
| 175 | + constructor(configuration: UIPlayerConfiguration = {}) { |
176 | 176 | super(); |
177 | 177 | const shadowRoot = this.attachShadow({ mode: 'open', delegatesFocus: true }); |
178 | 178 | shadowRoot.appendChild(template().content.cloneNode(true)); |
@@ -235,16 +235,16 @@ export class UIContainer extends HTMLElement { |
235 | 235 | * |
236 | 236 | * Used to create the underlying THEOplayer instance. |
237 | 237 | */ |
238 | | - get configuration(): PlayerConfiguration { |
| 238 | + get configuration(): UIPlayerConfiguration { |
239 | 239 | return this._configuration; |
240 | 240 | } |
241 | 241 |
|
242 | | - set configuration(playerConfiguration: PlayerConfiguration) { |
| 242 | + set configuration(playerConfiguration: UIPlayerConfiguration) { |
243 | 243 | this.removeAttribute(Attribute.CONFIGURATION); |
244 | 244 | this._setConfiguration(playerConfiguration); |
245 | 245 | } |
246 | 246 |
|
247 | | - private _setConfiguration(playerConfiguration: PlayerConfiguration): void { |
| 247 | + private _setConfiguration(playerConfiguration: UIPlayerConfiguration): void { |
248 | 248 | this._configuration = playerConfiguration ?? {}; |
249 | 249 | this.tryInitializePlayer_(); |
250 | 250 | } |
@@ -491,7 +491,7 @@ export class UIContainer extends HTMLElement { |
491 | 491 | } |
492 | 492 | const hasValue = newValue != null; |
493 | 493 | if (attrName === Attribute.CONFIGURATION) { |
494 | | - this._setConfiguration(newValue ? (JSON.parse(newValue) as PlayerConfiguration) : {}); |
| 494 | + this._setConfiguration(newValue ? (JSON.parse(newValue) as UIPlayerConfiguration) : {}); |
495 | 495 | } else if (attrName === Attribute.SOURCE) { |
496 | 496 | this._setSource(newValue ? (JSON.parse(newValue) as SourceDescription) : undefined); |
497 | 497 | } else if (attrName === Attribute.MUTED) { |
@@ -726,7 +726,10 @@ export class UIContainer extends HTMLElement { |
726 | 726 | const event = rawEvent as EnterFullscreenEvent; |
727 | 727 | event.stopPropagation(); |
728 | 728 | if (fullscreenAPI && document[fullscreenAPI.fullscreenEnabled_] && this[fullscreenAPI.requestFullscreen_]) { |
729 | | - const promise = this[fullscreenAPI.requestFullscreen_](); |
| 729 | + const promise = this[fullscreenAPI.requestFullscreen_]({ |
| 730 | + navigationUI: 'hide', |
| 731 | + ...this._configuration?.ui?.fullscreenOptions |
| 732 | + }); |
730 | 733 | if (promise && promise.then) { |
731 | 734 | promise.then(noOp, noOp); |
732 | 735 | } |
|
0 commit comments