Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:shiguredo/sora-devtools into fea…
Browse files Browse the repository at this point in the history
…ture/h265-params
  • Loading branch information
tnamao committed Dec 4, 2023
2 parents 960578b + 8ea3920 commit d31a7b4
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 44 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

## develop

- [ADD] コネクション ID とクライアント ID の表示にラベルを追加する
- @tnamao
- [ADD] Sora 接続後にセッション ID の表示を追加する
- @tnamao
- [FIX] `audio` `video` がともに無効な状態で Sora への接続時に getUserMedia を呼び出してしまう問題を修正する
- @tnamao
- [ADD] `dataChannels` のフォームにテンプレート読み込みボタンを追加する
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@
},
"devDependencies": {
"@biomejs/biome": "1.4.1",
"@types/node": "20.10.1",
"@types/react": "18.2.39",
"@types/node": "20.10.3",
"@types/react": "18.2.41",
"@types/react-redux": "7.1.31",
"@types/redux-logger": "3.0.12",
"@vitejs/plugin-react": "4.2.0",
"husky": "8.0.3",
"jsdom": "23.0.1",
"knip": "3.3.4",
"knip": "3.4.0",
"next": "14.0.3",
"rimraf": "5.0.5",
"typescript": "5.3.2",
Expand Down
64 changes: 33 additions & 31 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/app/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,9 @@ function setSoraCallbacks(
) {
dispatch(slice.actions.deleteFocusedSpotlightConnectionId(message.connection_id))
}
if (message.event_type === 'connection.created' && typeof message.session_id === 'string') {
dispatch(slice.actions.setSoraSessionId(message.session_id))
}
dispatch(
slice.actions.setNotifyMessages({
timestamp: new Date().getTime(),
Expand Down Expand Up @@ -899,6 +902,7 @@ function setSoraCallbacks(
fakeContents.worker.postMessage({ type: 'stop' })
}
dispatch(slice.actions.setSora(null))
dispatch(slice.actions.setSoraSessionId(null))
dispatch(slice.actions.setSoraConnectionStatus('disconnected'))
dispatch(slice.actions.setLocalMediaStream(null))
dispatch(slice.actions.removeAllRemoteMediaStreams())
Expand Down
4 changes: 4 additions & 0 deletions src/app/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const initialState: SoraDevtoolsState = {
sora: null,
connectionId: null,
clientId: null,
sessionId: null,
localMediaStream: null,
remoteMediaStreams: [],
prevStatsReport: [],
Expand Down Expand Up @@ -376,6 +377,9 @@ export const slice = createSlice({
state.soraContents.datachannels = []
}
},
setSoraSessionId: (state, action: PayloadAction<string | null>) => {
state.soraContents.sessionId = action.payload
},
setSoraConnectionStatus: (
state,
action: PayloadAction<SoraDevtoolsState['soraContents']['connectionStatus']>,
Expand Down
32 changes: 22 additions & 10 deletions src/components/Video/ConnectionStatusBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { copy2clipboard } from '@/utils'

type TextBoxProps = {
id?: string
label?: string
text: string
}
const TextBox: React.FC<TextBoxProps> = (props) => {
Expand All @@ -13,14 +14,17 @@ const TextBox: React.FC<TextBoxProps> = (props) => {
event.currentTarget.blur()
}
return (
<div className="d-flex align-items-center border border-secondary rounded mx-1">
<p id={props.id} className="mx-2 p-1">
{props.text}
</p>
<div className="border-left border-secondary">
<button type="button" className="btn btn-sm btn-light" onClick={onClick}>
<ClipboardIcon />
</button>
<div className="d-flex align-items-center">
{props.label ? <p>{props.label}</p> : null}
<div className="d-flex align-items-center border border-secondary rounded mx-1">
<p id={props.id} className="mx-2 p-1">
{props.text}
</p>
<div className="border-left border-secondary">
<button type="button" className="btn btn-sm btn-light" onClick={onClick}>
<ClipboardIcon />
</button>
</div>
</div>
</div>
)
Expand All @@ -36,10 +40,18 @@ export const ConnectionStatusBar: React.FC<Props> = (props) => {
return (
<>
{connectionId ? (
<TextBox id={localVideo ? 'local-video-connection-id' : undefined} text={connectionId} />
<TextBox
id={localVideo ? 'local-video-connection-id' : undefined}
label="connectionID:"
text={connectionId}
/>
) : null}
{clientId !== null && clientId !== undefined && connectionId !== clientId ? (
<TextBox id={localVideo ? 'local-video-client-id' : undefined} text={clientId} />
<TextBox
id={localVideo ? 'local-video-client-id' : undefined}
label="clientID:"
text={clientId}
/>
) : null}
</>
)
Expand Down
7 changes: 7 additions & 0 deletions src/components/Video/LocalVideo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { RequestRtpStreamButton } from './RequestRtpStreamButton'
import { RequestSpotlightRidButton } from './RequestSpotlightRidButton'
import { ResetRtpStreamButton } from './ResetRtpStreamButton'
import { ResetSpotlightRidButton } from './ResetSpotlightRidButton'
import { SessionStatusBar } from './SessionStatusBar'
import { Video } from './Video'
import { VolumeVisualizer } from './VolumeVisualizer'

Expand Down Expand Up @@ -54,6 +55,7 @@ const VideoBox: React.FC = () => {
export const LocalVideo: React.FC = () => {
const connectionId = useAppSelector((state) => state.soraContents.connectionId)
const clientId = useAppSelector((state) => state.soraContents.clientId)
const sessionId = useAppSelector((state) => state.soraContents.sessionId)
const simulcast = useAppSelector((state) => state.simulcast)
const spotlight = useAppSelector((state) => state.spotlight)
const role = useAppSelector((state) => state.role)
Expand All @@ -62,6 +64,11 @@ export const LocalVideo: React.FC = () => {
<div className="row my-1">
<div className="col-auto">
<div className="video-status mb-1">
{sessionId !== null ? (
<div className="d-flex align-items-center mb-1 video-status-inner">
<SessionStatusBar sessionId={sessionId} />
</div>
) : null}
{connectionId !== null || clientId !== null ? (
<div className="d-flex align-items-center mb-1 video-status-inner">
<ConnectionStatusBar connectionId={connectionId} clientId={clientId} localVideo />
Expand Down
Loading

0 comments on commit d31a7b4

Please sign in to comment.