2019-01-26 15:45:03 +00:00
|
|
|
|
|
|
|
const VideoAttachment = {
|
|
|
|
props: ['attachment', 'controls'],
|
|
|
|
data () {
|
|
|
|
return {
|
2019-10-06 20:28:30 +00:00
|
|
|
loopVideo: this.$store.getters.mergedConfig.loopVideo
|
2019-01-26 15:45:03 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
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) {
|
2019-10-06 20:28:30 +00:00
|
|
|
this.loopVideo = this.loopVideo && !this.$store.getters.mergedConfig.loopVideoSilentOnly
|
2019-01-26 15:45:03 +00:00
|
|
|
}
|
|
|
|
} else if (typeof target.mozHasAudio !== 'undefined') {
|
|
|
|
// true if video has audio track
|
|
|
|
if (target.mozHasAudio) {
|
2019-10-06 20:28:30 +00:00
|
|
|
this.loopVideo = this.loopVideo && !this.$store.getters.mergedConfig.loopVideoSilentOnly
|
2019-01-26 15:45:03 +00:00
|
|
|
}
|
|
|
|
} else if (typeof target.audioTracks !== 'undefined') {
|
|
|
|
if (target.audioTracks.length > 0) {
|
2019-10-06 20:28:30 +00:00
|
|
|
this.loopVideo = this.loopVideo && !this.$store.getters.mergedConfig.loopVideoSilentOnly
|
2019-01-26 15:45:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default VideoAttachment
|