Skip to content

Commit 11983cf

Browse files
committed
Add notice if video can not be played
1 parent 832f264 commit 11983cf

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

demo/client/file/file.coffee

+8
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ Template.file.onRendered ->
4141
self.showOriginal.set true
4242
return
4343
img.src = @data.file.link()
44+
45+
else if @data.file.isVideo
46+
video = document.getElementById @data.file._id
47+
unless video.canPlayType @data.file.type
48+
@$('#cantPlayVideo').show()
49+
video.style.display = 'none'
50+
else
51+
video.play()
4452
window.IS_RENDERED = true
4553
return
4654

demo/client/file/file.jade

+5-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,11 @@ template(name="file")
5656
.file-cell: audio.file-preview.file-audio(controls autoplay preload="auto" loop)
5757
source(src="{{link}}?play=true" type="#{type}")
5858
else if isVideo
59-
.file-cell: video.file-preview(controls autoplay preload="auto" loop)
60-
source(src="{{link}}?play=true" type="#{type}")
59+
.file-cell
60+
video.file-preview(id="{{_id}}" controls autoplay preload="auto" loop)
61+
p Can not play this video. The "#{type}" format may be not supported in your browser
62+
source(src="{{link}}?play=true" type="#{type}")
63+
p#cantPlayVideo(style="display:none") Can not play this video. The "#{type}" format may be not supported in your browser
6164
else if compare isText 'or' isJSON
6265
if warning
6366
.file-cell: h3.files-note

0 commit comments

Comments
 (0)