Skip to content

Commit

Permalink
Merge pull request #45 from montevideo-tech/feat/media-chrome-fullscr…
Browse files Browse the repository at this point in the history
…een-support

feat: fullscreen support for media chrome
  • Loading branch information
englishm authored Jan 30, 2025
2 parents f141613 + b4e7f35 commit fd29d95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/video-moq/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class VideoMoq extends HTMLElement {

set fullscreen(fullscreen: boolean) {
if (fullscreen) {
this.enterFullscreen().catch((err) => {
this.requestFullscreen().catch((err) => {
console.error("Error entering fullscreen:", err)
})
} else {
Expand Down Expand Up @@ -455,7 +455,7 @@ export class VideoMoq extends HTMLElement {
this.fullscreen = !document.fullscreenElement
}

private async enterFullscreen() {
public async requestFullscreen(): Promise<void> {
try {
if (this.#base) {
await this.#base.requestFullscreen()
Expand All @@ -465,7 +465,7 @@ export class VideoMoq extends HTMLElement {
}
}

private async exitFullscreen() {
public async exitFullscreen(): Promise<void> {
try {
await document.exitFullscreen()
} catch (error) {
Expand Down
4 changes: 1 addition & 3 deletions samples/media-chrome/media-chrome.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ <h1>Media Chrome Example</h1>
<video-moq
src="https://localhost:4443?namespace=bbb"
fingerprint="https://localhost:4443/fingerprint"
width="640px"
slot="media"
></video-moq>
<media-control-bar>
Expand All @@ -29,11 +28,10 @@ <h1>Media Chrome Example</h1>
</media-controller> -->

<!-- Using media-theme -->
<media-theme-x-mas>
<media-theme-x-mas style="width: 640px">
<video-moq
src="https://localhost:4443?namespace=bbb"
fingerprint="https://localhost:4443/fingerprint"
width="640px"
slot="media"
></video-moq>
</media-theme-x-mas>
Expand Down

0 comments on commit fd29d95

Please sign in to comment.