Skip to content

Commit

Permalink
pip stream window will muted at default
Browse files Browse the repository at this point in the history
  • Loading branch information
eric2788 committed Apr 15, 2024
1 parent 32e70a6 commit bea4f46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/contents/index/components/ButtonList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ function ButtonList(): JSX.Element {
const openMonitor = createPopupWindow(`stream.html`, {
roomId: info.room,
title: info.title,
owner: info.username
owner: info.username,
muted: enabledPip.toString() //in iframe, only muted video can autoplay
})

return (
Expand Down
10 changes: 6 additions & 4 deletions src/tabs/stream.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ import loadStream from '~players';
import { sendMessager } from '~utils/messaging';
import { useAsyncEffect } from '~hooks/life-cycle';

const urlParams = new URLSearchParams(window.location.search);
const roomId = urlParams.get('roomId');
const title = urlParams.get('title')
const owner = urlParams.get('owner')
const qs = new URLSearchParams(window.location.search);
const roomId = qs.get('roomId');
const title = qs.get('title')
const owner = qs.get('owner')
const mutedDefault = qs.get('muted') === 'true'

document.title = `${owner} 的直播间: ${title}`

Expand Down Expand Up @@ -162,6 +163,7 @@ function MonitorApp({ urls }: { urls: StreamUrls }): JSX.Element {
slot="media"
playsInline
autoPlay
muted={mutedDefault}
/>
<MediaLoadingIndicator slot="loading"></MediaLoadingIndicator>
<MediaControlBar className="flex justify-between">
Expand Down

0 comments on commit bea4f46

Please sign in to comment.