Skip to content

Commit

Permalink
spotlight sendrecv を一つにする
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntas committed Dec 25, 2024
1 parent 01050e8 commit b5430f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 36 deletions.
3 changes: 0 additions & 3 deletions examples/simulcast/main.mts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ document.addEventListener('DOMContentLoaded', () => {
const accessToken = import.meta.env.VITE_ACCESS_TOKEN || ''

const sendonly = new SimulcastSendonlySoraClient(signalingUrl, channelId, accessToken)

const recvonlyR0 = new SimulcastRecvonlySoraClient(signalingUrl, channelId, accessToken, 'r0')

const recvonlyR1 = new SimulcastRecvonlySoraClient(signalingUrl, channelId, accessToken, 'r1')

const recvonlyR2 = new SimulcastRecvonlySoraClient(signalingUrl, channelId, accessToken, 'r2')

document.querySelector('#connect')?.addEventListener('click', async () => {
Expand Down
25 changes: 8 additions & 17 deletions examples/spotlight_sendrecv/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,21 @@

<head>
<meta charset="utf-8">
<title>Spotlight Sendrecv test</title>
<title>Spotlight Sendrecv サンプル</title>
</head>

<body>
<div class="container">
<h1>Spotlight Sendrecv test</h1>
<h1>Spotlight Sendrecv サンプル</h1>
<div style="display: flex;">
<div>
<h2>sendrecv1</h2>
<button id="sendrecv1-connect">connect</button>
<button id="sendrecv1-disconnect">disconnect</button><br />
<video id="sendrecv1-local-video" autoplay="" playsinline="" controls=""
<h2>sendrecv</h2>
<button id="sendrecv-connect">connect</button>
<button id="sendrecv-disconnect">disconnect</button><br />
<video id="sendrecv-local-video" autoplay="" playsinline="" controls=""
style="width: 320px; height: 240px; border: 1px solid black;"></video>
<div id="sendrecv1-connection-id"></div>
<div id="sendrecv1-remote-videos"></div>
</div>
<div>
<h2>sendrecv2</h2>
<button id="sendrecv2-connect">connect</button>
<button id="sendrecv2-disconnect">disconnect</button><br />
<video id="sendrecv2-local-video" autoplay="" playsinline="" controls=""
style="width: 320px; height: 240px; border: 1px solid black;"></video>
<div id="sendrecv2-connection-id"></div>
<div id="sendrecv2-remote-videos"></div>
<div id="sendrecv-connection-id"></div>
<div id="sendrecv-remote-videos"></div>
</div>
</div>
</div>
Expand Down
21 changes: 5 additions & 16 deletions examples/spotlight_sendrecv/main.mts
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,14 @@ document.addEventListener('DOMContentLoaded', async () => {
const channelId = import.meta.env.VITE_SORA_CHANNEL_ID || ''
const accessToken = import.meta.env.VITE_ACCESS_TOKEN || ''

const sendrecv1 = new SoraClient('sendrecv1', signalingUrl, channelId, accessToken)
const sendrecv2 = new SoraClient('sendrecv2', signalingUrl, channelId, accessToken)
const sendrecv = new SoraClient('sendrecv', signalingUrl, channelId, accessToken)

document.querySelector('#sendrecv1-connect')?.addEventListener('click', async () => {
// sendrecv1
document.querySelector('#sendrecv-connect')?.addEventListener('click', async () => {
const stream = await navigator.mediaDevices.getUserMedia({ audio: true, video: true })
await sendrecv1.connect(stream)
await sendrecv.connect(stream)
})
document.querySelector('#sendrecv1-disconnect')?.addEventListener('click', async () => {
await sendrecv1.disconnect()
})

document.querySelector('#sendrecv2-connect')?.addEventListener('click', async () => {
// sendrecv2
const stream = await navigator.mediaDevices.getUserMedia({ audio: true, video: true })
await sendrecv2.connect(stream)
})
document.querySelector('#sendrecv2-disconnect')?.addEventListener('click', async () => {
await sendrecv2.disconnect()
document.querySelector('#sendrecv-disconnect')?.addEventListener('click', async () => {
await sendrecv.disconnect()
})
})

Expand Down

0 comments on commit b5430f1

Please sign in to comment.