Skip to content

Commit

Permalink
PlayerContainer: Do not auto play if a modal is openned
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinSRG committed Aug 30, 2023
1 parent 63a4e76 commit 34b90ff
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions frontend/src/components/layout/PlayerContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
:loopForced="loopForced"
:loopForcedValue="loopForcedValue"
@force-loop="onForceLoop"
:autoPlay="!(displayAlbumList || displayExtendedDescription || displaySizeStats || displayTagList)"
></VideoPlayer>
<AudioPlayer
v-if="mediaData && mediaData.type === 3"
Expand All @@ -88,6 +89,7 @@
:loopForced="loopForced"
:loopForcedValue="loopForcedValue"
@force-loop="onForceLoop"
:autoPlay="!(displayAlbumList || displayExtendedDescription || displaySizeStats || displayTagList)"
></AudioPlayer>

<AlbumListModal v-if="displayAlbumList" v-model:display="displayAlbumList"></AlbumListModal>
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/components/player/AudioPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ export default defineComponent({
loopForced: Boolean,
loopForcedValue: Boolean,
autoPlay: Boolean,
},
setup(props) {
return {
Expand Down Expand Up @@ -606,6 +608,11 @@ export default defineComponent({
if (this.autoPlayApplied) {
return;
}
if (!this.autoPlay) {
this.autoPlayApplied = true;
this.playing = false;
return;
}
const player = this.getAudioElement();
if (!player) {
return;
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/components/player/VideoPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ export default defineComponent({
loopForced: Boolean,
loopForcedValue: Boolean,
autoPlay: Boolean,
},
setup(props) {
return {
Expand Down Expand Up @@ -721,6 +723,11 @@ export default defineComponent({
if (this.autoPlayApplied) {
return;
}
if (!this.autoPlay) {
this.autoPlayApplied = true;
this.playing = false;
return;
}
const player = this.getVideoElement();
if (!player) {
return;
Expand Down

0 comments on commit 34b90ff

Please sign in to comment.