make hiding more efficient, make hiding not do its thing for reply forms or playing videos
This commit is contained in:
parent
42e43511de
commit
99e60f1821
5 changed files with 3 additions and 57 deletions
|
|
@ -10,7 +10,6 @@ const VideoAttachment = {
|
|||
computed: {
|
||||
loopVideo () {
|
||||
if (this.$store.getters.mergedConfig.loopVideoSilentOnly) {
|
||||
console.log('do I have audio', this.hasAudio)
|
||||
return !this.hasAudio
|
||||
}
|
||||
return this.$store.getters.mergedConfig.loopVideo
|
||||
|
|
@ -18,37 +17,32 @@ const VideoAttachment = {
|
|||
},
|
||||
methods: {
|
||||
onPlaying (e) {
|
||||
// Don't bother stopping suspend on small looping gif-like videos
|
||||
this.checkForAudio(e)
|
||||
this.setHasAudio(e)
|
||||
if (this.loopVideo) {
|
||||
return
|
||||
this.$emit('play', { looping: true })
|
||||
}
|
||||
this.$emit('play')
|
||||
},
|
||||
onPaused (e) {
|
||||
this.$emit('pause')
|
||||
},
|
||||
checkForAudio (e) {
|
||||
setHasAudio (e) {
|
||||
const target = e.srcElement || e.target
|
||||
if (this.hasAudio) return
|
||||
console.log(target.webkitAudioDecodedByteCount)
|
||||
if (typeof target.webkitAudioDecodedByteCount !== 'undefined') {
|
||||
// non-zero if video has audio track
|
||||
if (target.webkitAudioDecodedByteCount > 0) {
|
||||
console.log('1')
|
||||
this.hasAudio = true
|
||||
}
|
||||
}
|
||||
if (typeof target.mozHasAudio !== 'undefined') {
|
||||
// true if video has audio track
|
||||
if (target.mozHasAudio) {
|
||||
console.log('2')
|
||||
this.hasAudio = true
|
||||
}
|
||||
}
|
||||
if (typeof target.audioTracks !== 'undefined') {
|
||||
if (target.audioTracks.length > 0) {
|
||||
console.log('3')
|
||||
this.hasAudio = true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue