Skip to content

Commit

Permalink
終了処理を丁寧に
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntas committed Feb 22, 2024
1 parent 923bf14 commit 18f17c8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- run: pnpm install
- run: pnpm run build
- run: pnpm exec playwright install ${{ matrix.browser }} --with-deps
- run: pnpm exec playwright test --workers=1 --project=${{ matrix.browser }}
- run: pnpm exec playwright test --project=${{ matrix.browser }}
env:
VITE_SORA_CHANNEL_ID_SUFFIX: _${{ matrix.node }}
# - uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions examples/spotlight_recvonly/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ recvonly.on('track', (event) => {
recvonly.on('removetrack', (event) => {
const remoteVideo = document.querySelector(`#remotevideo-${event.target.id}`)
if (remoteVideo) {
remoteVideo.srcObject = null
document.querySelector('#remote-videos').removeChild(remoteVideo)
}
})
Expand Down
5 changes: 5 additions & 0 deletions examples/spotlight_sendonly/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ document.querySelector('#start-sendonly').addEventListener('click', async () =>
document.querySelector('#sendonly-local-video').srcObject = mediaStream
await sendonly.connect(mediaStream)
})

document.querySelector('#stop-sendonly').addEventListener('click', async () => {
document.querySelector('#sendonly-local-video').srcObject = null
await sendonly.disconnect()
})
19 changes: 9 additions & 10 deletions examples/spotlight_sendrecv/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ sendrecv2.on('track', (event) => {
sendrecv2.on('removetrack', (event) => {
const remoteVideo = document.querySelector(`#sendrecv2-remotevideo-${event.target.id}`)
if (remoteVideo) {
remoteVideo.srcObject = null
document.querySelector('#sendrecv2-remote-videos').removeChild(remoteVideo)
}
})
Expand All @@ -94,15 +95,13 @@ document.querySelector('#start-sendrecv2').addEventListener('click', async () =>
document.querySelector('#sendrecv2-local-video').srcObject = mediaStream
await sendrecv2.connect(mediaStream)
})
document.querySelector('#stop-sendrecv1').addEventListener('click', () => {
sendrecv1.disconnect().then(() => {
document.querySelector('#sendrecv1-local-video').srcObject = null
document.querySelector('#sendrecv1-remote-videos').innerHTML = null
})
document.querySelector('#stop-sendrecv1').addEventListener('click', async () => {
await sendrecv1.disconnect()
document.querySelector('#sendrecv1-local-video').srcObject = null
document.querySelector('#sendrecv1-remote-videos').innerHTML = null
})
document.querySelector('#stop-sendrecv2').addEventListener('click', () => {
sendrecv2.disconnect().then(() => {
document.querySelector('#sendrecv2-local-video').srcObject = null
document.querySelector('#sendrecv2-remote-videos').innerHTML = null
})
document.querySelector('#stop-sendrecv2').addEventListener('click', async () => {
sendrecv2.disconnect()
document.querySelector('#sendrecv2-local-video').srcObject = null
document.querySelector('#sendrecv2-remote-videos').innerHTML = null
})

0 comments on commit 18f17c8

Please sign in to comment.