Skip to content

Commit e8bc9c7

Browse files
committed
(fix) video media preview
1 parent 866a9a0 commit e8bc9c7

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

src/lib/ChatWindow.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export default {
168168
scrollDistance: { type: Number, default: 60 },
169169
acceptedFiles: { type: String, default: '*' },
170170
templatesText: { type: Array, default: null },
171-
mediaModalPreview: { type: Boolean, default: true }
171+
mediaPreviewEnabled: { type: Boolean, default: true }
172172
},
173173
174174
emits: [
@@ -341,7 +341,7 @@ export default {
341341
this.$emit('delete-message', { message, roomId: this.room.roomId })
342342
},
343343
openFile({ message, file }) {
344-
if (this.mediaModalPreview && file.action === 'preview') {
344+
if (this.mediaPreviewEnabled && file.action === 'preview') {
345345
this.filePreview = file.file
346346
this.showMediaPreview = true
347347
} else {

src/lib/MediaPreview/MediaPreview.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
/>
1717
</div>
1818

19-
<div v-else-if="isVideo" class="vac-video-preview">
20-
<video width="100%" height="100%" controls>
19+
<div v-else-if="isVideo" class="vac-media-preview-container">
20+
<video width="100%" height="100%" controls autoplay>
2121
<source :src="file.url" />
2222
</video>
2323
</div>
@@ -45,7 +45,7 @@ export default {
4545
file: { type: Object, required: true }
4646
},
4747
48-
emits: ['open-file'],
48+
emits: ['close-media-preview'],
4949
5050
computed: {
5151
isImage() {

src/lib/Message/MessageFiles/MessageFile/MessageFile.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
width: 350px;
5656
max-width: 100%;
5757
margin: 4px auto 5px;
58+
cursor: pointer;
5859

5960
video {
6061
border-radius: 4px;

src/lib/Message/MessageFiles/MessageFile/MessageFile.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@
5858
</div>
5959
</div>
6060

61-
<div v-else-if="isVideo" class="vac-video-container">
61+
<div
62+
v-else-if="isVideo"
63+
class="vac-video-container"
64+
@click.stop.prevent="openFile('preview')"
65+
>
6266
<video width="100%" height="100%" controls>
6367
<source :src="file.url" />
6468
</video>

0 commit comments

Comments
 (0)