From 18f17c88f9b14b30b6f38171abfa38a98462d962 Mon Sep 17 00:00:00 2001 From: voluntas Date: Thu, 22 Feb 2024 11:40:34 +0900 Subject: [PATCH] =?UTF-8?q?=E7=B5=82=E4=BA=86=E5=87=A6=E7=90=86=E3=82=92?= =?UTF-8?q?=E4=B8=81=E5=AF=A7=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/e2e-test.yml | 2 +- examples/spotlight_recvonly/main.mjs | 1 + examples/spotlight_sendonly/main.mjs | 5 +++++ examples/spotlight_sendrecv/main.mjs | 19 +++++++++---------- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 0763ec31..8ee988d5 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -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 diff --git a/examples/spotlight_recvonly/main.mjs b/examples/spotlight_recvonly/main.mjs index 3aaf0585..1b304a6a 100644 --- a/examples/spotlight_recvonly/main.mjs +++ b/examples/spotlight_recvonly/main.mjs @@ -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) } }) diff --git a/examples/spotlight_sendonly/main.mjs b/examples/spotlight_sendonly/main.mjs index ca0d6dc0..10706a21 100644 --- a/examples/spotlight_sendonly/main.mjs +++ b/examples/spotlight_sendonly/main.mjs @@ -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() +}) diff --git a/examples/spotlight_sendrecv/main.mjs b/examples/spotlight_sendrecv/main.mjs index 3c7d129c..6f583aed 100644 --- a/examples/spotlight_sendrecv/main.mjs +++ b/examples/spotlight_sendrecv/main.mjs @@ -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) } }) @@ -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 })