Skip to content

Commit

Permalink
fixup! feat(audioPlayer): Auto play voice messages which are grouped …
Browse files Browse the repository at this point in the history
…together

Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy committed Sep 25, 2024
1 parent f775929 commit 4ef10eb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/components/MessagesList/MessagesGroup/Message/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,11 @@ export default {
component: FilePreview,
props: {
token: this.message.token,
messageId: Number(this.message.id),
messageId: this.message.id,
nextMessageId: this.nextMessageId,
itemType,
referenceId: this.message.referenceId,
file: this.message.messageParameters[p],
nextMessageId: this.nextMessageId,
},
}
} else if (type === 'deck-card') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export default {
t,
handleEnded() {
// Return early if next message ID not found
if (!this.nextMessageId) {
return
}
Expand All @@ -108,19 +107,16 @@ export default {
},
/**
* Auto-paly the audio if the previous message was played.
* Autoplay the audio message as soon as previous one was played
*
* @param {number} messageId Message ID to play.
*
* @return {boolean} true if the audio was played, false otherwise
*/
autoPlay(messageId) {
if (!this.$refs.audioPlayer || messageId !== this.messageId) {
return false
if (messageId !== this.messageId) {
return
}
this.$refs.audioPlayer.play()
return true
this.$refs.audioPlayer?.play()
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ export default {
},
messageId: {
type: Number,
type: [String, Number],
default: 0,
},
nextMessageId: {
type: [String, Number],
default: 0,
},
Expand Down Expand Up @@ -168,11 +173,6 @@ export default {
type: String,
default: '',
},
nextMessageId: {
type: [String, Number],
default: 0,
},
},
emits: ['remove-file'],
Expand Down

0 comments on commit 4ef10eb

Please sign in to comment.