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

Implement setting to mute/unmute video #856

Merged
merged 2 commits into from
Jun 14, 2024
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
12 changes: 12 additions & 0 deletions resources/assets/js/videos/components/settingsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default {
'showMousePosition',
'showProgressIndicator',
'jumpStep',
'muteVideo'
],
annotationOpacity: 1,
showMinimap: true,
Expand All @@ -25,6 +26,7 @@ export default {
playbackRate: 1.0,
jumpStep: 5.0,
showProgressIndicator: true,
muteVideo: true,
};
},
methods: {
Expand Down Expand Up @@ -52,6 +54,12 @@ export default {
handleHideProgressIndicator() {
this.showProgressIndicator = false;
},
handleMuteVideo() {
this.muteVideo = true;
},
handleUnmuteVideo() {
this.muteVideo = false;
},
},
watch: {
annotationOpacity(value) {
Expand Down Expand Up @@ -93,6 +101,10 @@ export default {
this.$emit('update', 'showProgressIndicator', show);
Settings.set('showProgressIndicator', show);
},
muteVideo(show) {
this.$emit('update', 'muteVideo', show);
Settings.set('muteVideo', show);
},
},
created() {
this.restoreKeys.forEach((key) => {
Expand Down
1 change: 1 addition & 0 deletions resources/assets/js/videos/stores/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ let defaults = {
showMousePosition: false,
showProgressIndicator: true,
jumpStep: 5.0,
muteVideo: true,
};

export default new Settings({
Expand Down
6 changes: 5 additions & 1 deletion resources/assets/js/videos/videoContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export default {
playbackRate: 1.0,
jumpStep: 5.0,
showProgressIndicator: true,
muteVideo: true,
},
openTab: '',
urlParams: {
Expand Down Expand Up @@ -671,6 +672,9 @@ export default {
'settings.playbackRate'(rate) {
this.video.playbackRate = rate;
},
'settings.muteVideo'(mute) {
this.video.muted = mute;
},
urlParams: {
deep: true,
handler(params) {
Expand All @@ -697,7 +701,7 @@ export default {

this.initAnnotationFilters();
this.restoreUrlParams();
this.video.muted = true;
this.video.muted = this.settings.muteVideo;
this.video.preload = 'auto';
this.video.addEventListener('error', function (e) {
if (e.target.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED) {
Expand Down
4 changes: 4 additions & 0 deletions resources/views/manual/tutorials/videos/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,9 @@
<p>
The mouse position switch controls the display of an additional map overlay that shows the current position of the cursor on the video in pixels.
</p>

<p>
The mute video switch enables or disables the audio track of the video.
</p>
</div>
@endsection
4 changes: 4 additions & 0 deletions resources/views/videos/show/sidebar-settings.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
<power-toggle :active="showMousePosition" title-off="Show mouse position" title-on="Hide mouse position" v-on:on="handleShowMousePosition" v-on:off="handleHideMousePosition">Mouse Position</power-toggle>
</div>

<div class="sidebar-tab__section">
<power-toggle :active="muteVideo" title-off="Mute video" title-on="Unmute video" v-on:on="handleMuteVideo" v-on:off="handleUnmuteVideo">Mute Video</power-toggle>
</div>

</div>
</settings-tab>
</sidebar-tab>