Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(volume): bind output slider volume to stream volume #3453

Merged
merged 4 commits into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/ui/Chat/TypingIndicator/TypingIndicator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default Vue.extend({
*/
methods: {
checkUsersTyping() {
if (this.users.length <= 3 && this.users.length != 0) {
if (this.users.length <= 3 && this.users.length) {
return 1
}
if (this.users.length > 3) {
Expand Down
12 changes: 12 additions & 0 deletions components/views/media/Media.vue
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,18 @@ export default Vue.extend({
})
}
},
'audio.volume': {
handler(volume) {
// Bind stream audio element volume to slider volume
const audioStreamElements = document.getElementsByClassName(
'remote-audio-stream',
) as HTMLCollectionOf<HTMLAudioElement>
molimauro marked this conversation as resolved.
Show resolved Hide resolved

for (const audioStreamElement of audioStreamElements) {
audioStreamElement.volume = volume / 100
}
},
},
},
beforeMount() {
// TODO: Create mixin/library that will handle call rejoining and closing
Expand Down
11 changes: 6 additions & 5 deletions components/views/media/user/User.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@
/>
<TypographyTag :text="user.name" inverted />
</div>
<div
v-if="!isLocal && !audio.deafened && audioStream"
class="audio-stream-container"
>
<audio :src-object.prop="audioStream" autoplay />
<div
v-if="!isLocal && !audio.deafened && audioStream"
class="audio-stream-container"
>
<audio :id="`audio-stream-${audioStream.id}`" :class="`${isLocal ? 'local' : 'remote'}-audio-stream`" :src-object.prop="audioStream" autoplay />
</div>
</div>
</div>
12 changes: 12 additions & 0 deletions components/views/media/user/User.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,18 @@ export default Vue.extend({
loadVideos()
})
},
updated() {
// When audio is streamed, initialize stream volume to current volume.
if (!this.isLocal && !this.audio.deafened && this.audioStream) {
const audioStreamElements = document.getElementsByClassName(
`remote-audio-stream`,
) as HTMLCollectionOf<HTMLAudioElement>
molimauro marked this conversation as resolved.
Show resolved Hide resolved

for (const audioStreamElement of audioStreamElements) {
audioStreamElement.volume = this.audio.volume / 100
}
}
},
})
</script>

Expand Down
2 changes: 1 addition & 1 deletion components/views/settings/pages/realms/realm/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default Vue.extend({
props: {
realm: {
type: Object as PropType<Realm>,
default: {},
default: () => ({}),
},
},
computed: {
Expand Down