diff options
| author | lambda <pleromagit@rogerbraun.net> | 2019-01-30 18:58:08 +0000 |
|---|---|---|
| committer | lambda <pleromagit@rogerbraun.net> | 2019-01-30 18:58:08 +0000 |
| commit | 5b7b1dfebc37bd5db4e839973062b452b02c898d (patch) | |
| tree | a517e4942725286b173b685cbe87bc6c7878b66e /src/components/video_attachment/video_attachment.js | |
| parent | b1facdf7ad54436c2afde7c28c917cda87a5b7e3 (diff) | |
| parent | c7cffbb6c70bbb21cf787d96e82e0261427b9234 (diff) | |
Merge branch 'feat/media-modal' into 'develop'
modal for viewing attachments in-tab
See merge request pleroma/pleroma-fe!468
Diffstat (limited to 'src/components/video_attachment/video_attachment.js')
| -rw-r--r-- | src/components/video_attachment/video_attachment.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/components/video_attachment/video_attachment.js b/src/components/video_attachment/video_attachment.js new file mode 100644 index 00000000..76b19a02 --- /dev/null +++ b/src/components/video_attachment/video_attachment.js @@ -0,0 +1,31 @@ + +const VideoAttachment = { + props: ['attachment', 'controls'], + data () { + return { + loopVideo: this.$store.state.config.loopVideo + } + }, + methods: { + onVideoDataLoad (e) { + const target = e.srcElement || e.target + if (typeof target.webkitAudioDecodedByteCount !== 'undefined') { + // non-zero if video has audio track + if (target.webkitAudioDecodedByteCount > 0) { + this.loopVideo = this.loopVideo && !this.$store.state.config.loopVideoSilentOnly + } + } else if (typeof target.mozHasAudio !== 'undefined') { + // true if video has audio track + if (target.mozHasAudio) { + this.loopVideo = this.loopVideo && !this.$store.state.config.loopVideoSilentOnly + } + } else if (typeof target.audioTracks !== 'undefined') { + if (target.audioTracks.length > 0) { + this.loopVideo = this.loopVideo && !this.$store.state.config.loopVideoSilentOnly + } + } + } + } +} + +export default VideoAttachment |
