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

Better control bar #116

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Move ControlBar to separate component
  • Loading branch information
darnfish committed May 30, 2020
commit 6eb75eaf58bfd8a9349e01875d27a226c32e2958
38 changes: 38 additions & 0 deletions components/Player/ControlBar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<template>
<div class="control-bar">
<div class="control-inner">
<div class="volume-controls">
<img v-if="!this.isStreamMuted" src="/icons/speaker-unmuted.svg" alt="" class="icon" @click="toggleStreamMute"/>
<img v-else src="/icons/speaker-muted.svg" alt="" class="icon" @click="toggleStreamMute"/>
<input
v-model="volumeValue"
class="volume-slider"
type="range"
min="0"
max="100"
value=100
step="1"
@input="volumeChanged"
/>
</div>
<img src="/icons/fullscreen.svg" alt="" class="fullscreen-toggle icon" @click="toggleFullscreen"/>
</div>
</div>
</template>

<script>
export default {
methods: {
toggleStreamMute() {
this.isStreamMuted = !this.isStreamMuted
this.$store.commit('setMutedStatus', this.isStreamMuted)
},
volumeChanged() {
this.$store.commit('setViewerVolume', this.volumeValue)
},
toggleFullscreen() {
this.$root.$emit('toggle-fullscreen')
}
}
}
</script>
29 changes: 0 additions & 29 deletions components/Player/Footer.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
<template>
<div class="player-footer">
<div class="control-bar">
<div class="volume-controls">
<img v-if="!this.isStreamMuted" src="/icons/speaker-unmuted.svg" alt="" class="icon" @click="toggleStreamMute"/>
<img v-else src="/icons/speaker-muted.svg" alt="" class="icon" @click="toggleStreamMute"/>
<input
v-model="volumeValue"
class="volume-slider"
type="range"
min="0"
max="100"
value=100
step="1"
@input="volumeChanged"
/>
</div>
<img src="/icons/fullscreen.svg" alt="" class="fullscreen-toggle icon" @click="toggleFullscreen"/>
</div>
<div class="user-icons">
<UserIcon
v-for="member in members"
Expand Down Expand Up @@ -69,18 +52,6 @@

return [...new Set(this.room.members.map(({ id }) => id))]
}
},
methods: {
toggleStreamMute() {
this.isStreamMuted = !this.isStreamMuted
this.$store.commit('setMutedStatus', this.isStreamMuted)
},
volumeChanged() {
this.$store.commit('setViewerVolume', this.volumeValue)
},
toggleFullscreen() {
this.$root.$emit('toggle-fullscreen')
}
}
}
</script>
7 changes: 5 additions & 2 deletions components/Player/Viewer.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="player" ref="viewport" :class="{ 'capture-events': hasControl }">
<div class="player" ref="viewport" :class="{ 'has-control capture-events': hasControl }">
<p v-if=showPlayerDevtools class="player-dev">
Portal ID: {{ portal.id }}
<br>
Expand Down Expand Up @@ -36,6 +36,7 @@
@mousewheel=didMouseWheel
@contextmenu=handleRightClick
/>
<ControlBar />
<div v-if=showMutedPopup class="player-tooltips">
<div class="player-tooltip" :class="{ visible: showMutedPopup }">
<div class="player-tooltip-info">
Expand All @@ -59,10 +60,12 @@
import brand from '~/brand/config'

import Button from '~/components/Button'
import ControlBar from '~/components/Player/ControlBar'

export default {
components: {
Button
Button,
ControlBar
},
props: {
volume: Number,
Expand Down