Don't pause WebMs with audio when off screen.

This commit is contained in:
ccd0 2015-01-31 11:48:28 -08:00
parent 8df52a0b24
commit a85d5b2335
3 changed files with 5 additions and 1 deletions

View File

@ -296,6 +296,9 @@ $.minmax = (value, min, max) ->
value
)
$.hasAudio = (video) ->
video.mozHasAudio or !!video.webkitAudioDecodedByteCount
$.item = (key, val) ->
item = {}
item[key] = val

View File

@ -76,6 +76,7 @@ ImageExpand =
g.posts.forEach (post) ->
for post in [post, post.clones...] when post.file and post.file.isVideo and post.file.isExpanded
video = post.file.fullImage
continue if $.hasAudio video
visible = Header.isNodeVisible video
if visible and post.file.wasPlaying
delete post.file.wasPlaying

View File

@ -404,7 +404,7 @@ QR =
else if duration > QR.max_duration_video
QR.error "#{file.name}: Video too long (video: #{duration}s, max: #{QR.max_duration_video}s)"
pass = false
if g.BOARD.ID not in ['gif', 'wsg'] and (video.mozHasAudio or video.webkitAudioDecodedByteCount)
if g.BOARD.ID not in ['gif', 'wsg'] and $.hasAudio video
QR.error "#{file.name}: Audio not allowed"
pass = false
cb pass, video