Show More
@@ -3,7 +3,10 b' from django.contrib.staticfiles.template' | |||||
3 |
|
3 | |||
4 | FILE_STUB_IMAGE = 'images/file.png' |
|
4 | FILE_STUB_IMAGE = 'images/file.png' | |
5 |
|
5 | |||
6 |
FILE_TYPE |
|
6 | FILE_TYPES_VIDEO = ( | |
|
7 | 'webm', | |||
|
8 | 'mp4', | |||
|
9 | ) | |||
7 | FILE_TYPE_SVG = 'svg' |
|
10 | FILE_TYPE_SVG = 'svg' | |
8 | FILE_TYPES_AUDIO = ( |
|
11 | FILE_TYPES_AUDIO = ( | |
9 | 'ogg', |
|
12 | 'ogg', | |
@@ -37,10 +40,10 b' class AbstractViewer:' | |||||
37 | '</a>'.format(self.file.url,static(FILE_STUB_IMAGE)) |
|
40 | '</a>'.format(self.file.url,static(FILE_STUB_IMAGE)) | |
38 |
|
41 | |||
39 |
|
42 | |||
40 |
class |
|
43 | class VideoViewer(AbstractViewer): | |
41 | @staticmethod |
|
44 | @staticmethod | |
42 | def supports(file_type): |
|
45 | def supports(file_type): | |
43 |
return file_type |
|
46 | return file_type in FILE_TYPES_VIDEO | |
44 |
|
47 | |||
45 | def get_format_view(self): |
|
48 | def get_format_view(self): | |
46 | return '<video width="200" height="150" controls src="{}"></video>'\ |
|
49 | return '<video width="200" height="150" controls src="{}"></video>'\ |
General Comments 0
You need to be logged in to leave comments.
Login now