Skip to content

Commit

Permalink
Merge pull request #4467 from traPtitech/feat/screenshare_component
Browse files Browse the repository at this point in the history
サブビューを実装
  • Loading branch information
nokhnaton authored Jan 22, 2025
2 parents 1d9b157 + dd5333f commit 1ab105e
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 20 deletions.
1 change: 1 addition & 0 deletions src/components/Main/MainView/ChannelView/ChannelView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
:pinned-messages="pinnedMessages"
:typing-users="typingUsers"
/>
<!-- <SubQallView /> -->

Check warning on line 15 in src/components/Main/MainView/ChannelView/ChannelView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelView.vue#L15

Added line #L15 was not covered by tests
</template>
<template #sidebar>
<channel-sidebar
Expand Down
4 changes: 3 additions & 1 deletion src/components/Main/MainView/QallView/AudioTrack.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ onMounted(() => {
})

Check warning on line 21 in src/components/Main/MainView/QallView/AudioTrack.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/AudioTrack.vue#L17-L21

Added lines #L17 - L21 were not covered by tests
onUnmounted(() => {
trackInfo.trackPublication?.track?.detach()
if (audioElement.value) {
trackInfo.trackPublication?.track?.detach(audioElement.value)
}
})

Check warning on line 27 in src/components/Main/MainView/QallView/AudioTrack.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/AudioTrack.vue#L23-L27

Added lines #L23 - L27 were not covered by tests
</script>

Expand Down
13 changes: 7 additions & 6 deletions src/components/Main/MainView/QallView/QallView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import DanmakuContainer from './DanmakuContainer.vue'
import CallControlButton from './CallControlButton.vue'
import CallControlButtonSmall from './CallControlButtonSmall.vue'
import ScreenShareComponent from './ScreenShareComponent.vue'
import { LocalTrackPublication } from 'livekit-client'

Check warning on line 10 in src/components/Main/MainView/QallView/QallView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallView.vue#L2-L10

Added lines #L2 - L10 were not covered by tests
const {
tracksMap,
Expand Down Expand Up @@ -71,6 +72,7 @@ const toggleVideo = async () => {
for (const trackInfo of tracksMap.value.values()) {
if (
!trackInfo.isRemote &&
trackInfo.trackPublication instanceof LocalTrackPublication &&
trackInfo.trackPublication?.kind === 'video' &&
!trackInfo.trackPublication.trackName?.includes('screen')
) {
Expand All @@ -97,6 +99,7 @@ const toggleScreen = async () => {
for (const trackInfo of tracksMap.value.values()) {
if (
!trackInfo.isRemote &&
trackInfo.trackPublication instanceof LocalTrackPublication &&
trackInfo.trackPublication?.kind === 'video' &&
trackInfo.trackPublication.trackName?.includes('screen')
) {
Expand Down Expand Up @@ -188,17 +191,13 @@ const backgroundType = ref<'original' | 'blur' | 'file' | 'screen'>('original')
</button>

Check warning on line 191 in src/components/Main/MainView/QallView/QallView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallView.vue#L191

Added line #L191 was not covered by tests

<div :class="$style.TrackContainer">
<template
v-for="([sid, track], index) in tracksMap.entries()"
:key="index"
>
<template v-for="[sid, track] in tracksMap.entries()" :key="sid">
<VideoComponent
v-if="

Check warning on line 196 in src/components/Main/MainView/QallView/QallView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallView.vue#L193-L196

Added lines #L193 - L196 were not covered by tests
track.trackPublication?.kind === 'video' &&
!screenShareTrackSidMap.has(sid)
"
:track-info="track"
:participant-identity="track.participantIdentity"
:class="$style.video"
/>
<ScreenShareComponent
Expand All @@ -214,7 +213,9 @@ const backgroundType = ref<'original' | 'blur' | 'file' | 'screen'>('original')
v-else-if="
track.trackPublication?.kind === 'audio' &&

Check warning on line 214 in src/components/Main/MainView/QallView/QallView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallView.vue#L210-L214

Added lines #L210 - L214 were not covered by tests
track.isRemote &&
!screenShareTrackSidMap.values().some(valueSid => valueSid === sid)
!screenShareTrackSidMap
.values()
?.some?.(valueSid => valueSid === sid)
"
:track-info="track"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ onMounted(() => {
})

Check warning on line 28 in src/components/Main/MainView/QallView/ScreenShareComponent.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/ScreenShareComponent.vue#L23-L28

Added lines #L23 - L28 were not covered by tests
onUnmounted(() => {
trackInfo.trackPublication?.track?.detach()
audioTrackInfo?.trackPublication?.track?.detach()
if (videoElement.value && audioElement.value) {
trackInfo.trackPublication?.track?.detach(videoElement.value)
audioTrackInfo?.trackPublication?.track?.detach(audioElement.value)
}
})

Check warning on line 35 in src/components/Main/MainView/QallView/ScreenShareComponent.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/ScreenShareComponent.vue#L30-L35

Added lines #L30 - L35 were not covered by tests
</script>

Expand Down
29 changes: 29 additions & 0 deletions src/components/Main/MainView/QallView/SubQallView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<script lang="ts" setup>
import { computed } from 'vue'
import AudioTrack from './AudioTrack.vue'
import VideoTrack from './VideoTrack.vue'
import { useQall } from '/@/composables/qall/useQall'

Check warning on line 5 in src/components/Main/MainView/QallView/SubQallView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/SubQallView.vue#L2-L5

Added lines #L2 - L5 were not covered by tests
const { tracksMap } = useQall()

Check warning on line 7 in src/components/Main/MainView/QallView/SubQallView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/SubQallView.vue#L7

Added line #L7 was not covered by tests
const firstVideoTrack = computed(
() =>
tracksMap.value &&
Array.from(tracksMap.value.entries()).find(
([_sid, track]) => track.trackPublication?.kind === 'video'
)
)

Check warning on line 15 in src/components/Main/MainView/QallView/SubQallView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/SubQallView.vue#L9-L15

Added lines #L9 - L15 were not covered by tests
</script>
<template>
<VideoTrack
v-if="firstVideoTrack"
:key="firstVideoTrack[0]"
:track-info="firstVideoTrack[1]"
/>
<template v-for="[sid, track] in tracksMap.entries()" :key="sid">
<audio-track
v-if="track.trackPublication?.kind === 'audio'"
:track-info="track"
/>
</template>

Check warning on line 28 in src/components/Main/MainView/QallView/SubQallView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/SubQallView.vue#L18-L28

Added lines #L18 - L28 were not covered by tests
</template>
11 changes: 6 additions & 5 deletions src/components/Main/MainView/QallView/VideoTrack.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import { onMounted, onUnmounted, ref, useTemplateRef, watchEffect } from 'vue'
import { useQall } from '/@/composables/qall/useQall'

Check warning on line 3 in src/components/Main/MainView/QallView/VideoTrack.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/VideoTrack.vue#L2-L3

Added lines #L2 - L3 were not covered by tests
import type { TrackInfo } from '/@/composables/qall/useLiveKitSDK'
const { trackInfo, participantIdentity } = defineProps<{
const { trackInfo } = defineProps<{
trackInfo: TrackInfo
participantIdentity: string
}>()
const { removeVideoTrack } = useQall()

Check warning on line 10 in src/components/Main/MainView/QallView/VideoTrack.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/VideoTrack.vue#L10

Added line #L10 was not covered by tests
Expand All @@ -25,14 +24,16 @@ onMounted(() => {
})

Check warning on line 24 in src/components/Main/MainView/QallView/VideoTrack.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/VideoTrack.vue#L20-L24

Added lines #L20 - L24 were not covered by tests
onUnmounted(() => {
trackInfo.trackPublication?.track?.detach()
if (videoElement.value) {
trackInfo.trackPublication?.track?.detach(videoElement.value)
}
})

Check warning on line 30 in src/components/Main/MainView/QallView/VideoTrack.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/VideoTrack.vue#L26-L30

Added lines #L26 - L30 were not covered by tests
</script>

<template>
<div :id="'camera-' + participantIdentity">
<div :id="'camera-' + trackInfo.participantIdentity">
<div>
<p>{{ participantIdentity }}</p>
<p>{{ trackInfo.participantIdentity }}</p>
</div>
<video
v-if="trackInfo.trackPublication"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Main/NavigationBar/DesktopNavigationBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/>
<transition name="fade-bottom">
<ephemeral-navigation-content
v-if="ephemeralNavigationSelectorState.currentNavigation"
v-if="true"

Check warning on line 23 in src/components/Main/NavigationBar/DesktopNavigationBar.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/NavigationBar/DesktopNavigationBar.vue#L23

Added line #L23 was not covered by tests
:class="$style.ephemeralNavigation"
:current-ephemeral-navigation="
ephemeralNavigationSelectorState.currentNavigation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<ephemeral-navigation-content-container :transparent="transparent">
<transition name="fade-bottom" mode="out-in">
<qall-controller v-if="currentEphemeralNavigation === 'qallController'" />
<draft-list v-else-if="currentEphemeralNavigation === 'draftList'" />
<SubQallView v-else-if="currentEphemeralNavigation === 'draftList'" />

Check warning on line 5 in src/components/Main/NavigationBar/EphemeralNavigationContent/EphemeralNavigationContent.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/NavigationBar/EphemeralNavigationContent/EphemeralNavigationContent.vue#L5

Added line #L5 was not covered by tests

<!-- <draft-list v-else-if="currentEphemeralNavigation === 'draftList'" /> -->
<audio-controller
v-else-if="currentEphemeralNavigation === 'audioController'"
/>
Expand All @@ -16,6 +18,7 @@ import QallController from './QallController/QallController.vue'
import DraftList from './DraftList/DraftList.vue'

Check warning on line 18 in src/components/Main/NavigationBar/EphemeralNavigationContent/EphemeralNavigationContent.vue

View workflow job for this annotation

GitHub Actions / run lint

'DraftList' is defined but never used
import AudioController from './AudioController/AudioController.vue'
import type { EphemeralNavigationItemType } from '/@/components/Main/NavigationBar/composables/useNavigationConstructor'
import SubQallView from '../../MainView/QallView/SubQallView.vue'

Check warning on line 21 in src/components/Main/NavigationBar/EphemeralNavigationContent/EphemeralNavigationContent.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/NavigationBar/EphemeralNavigationContent/EphemeralNavigationContent.vue#L21

Added line #L21 was not covered by tests
withDefaults(
defineProps<{
Expand Down
8 changes: 4 additions & 4 deletions src/composables/qall/useLiveKitSDK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,10 @@ const addScreenShareTrack = async () => {
[videoSid]: audioSid
}
screenShareTrackSidMap.value.set(videoSid, audioSid)

Check warning on line 369 in src/composables/qall/useLiveKitSDK.ts

View check run for this annotation

Codecov / codecov/patch

src/composables/qall/useLiveKitSDK.ts#L347-L369

Added lines #L347 - L369 were not covered by tests
await room.value.localParticipant.setAttributes({
...room.value.localParticipant.attributes,
[videoSid]: audioSid
})
// await room.value.localParticipant.setAttributes({
// ...room.value.localParticipant.attributes,
// [videoSid]: audioSid
// })
}
} catch {

Check warning on line 375 in src/composables/qall/useLiveKitSDK.ts

View check run for this annotation

Codecov / codecov/patch

src/composables/qall/useLiveKitSDK.ts#L374-L375

Added lines #L374 - L375 were not covered by tests
// TODO:シェアをキャンセルした時も失敗しましたメッセージがでるのはちょっと違和感があるかも
Expand Down

0 comments on commit 1ab105e

Please sign in to comment.