Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Websites UFRPE
Wagtail Videos
Commits
16d57461
Commit
16d57461
authored
Oct 19, 2016
by
Tim Heap
Committed by
GitHub
Oct 19, 2016
Browse files
Merge pull request #12 from takeflight/video-source-reorder
Video source reorder
parents
db19bd9c
69be3da5
Changes
2
Hide whitespace changes
Inline
Side-by-side
wagtailvideos/models.py
View file @
16d57461
...
...
@@ -244,13 +244,15 @@ class AbstractVideo(CollectionMember, TagSearchable):
if
self
.
thumbnail
:
attrs
[
'poster'
]
=
self
.
thumbnail
.
url
mime
=
mimetypes
.
MimeTypes
()
sources
=
[
"<source src='{0}' type='{1}'>"
.
format
(
self
.
url
,
mime
.
guess_type
(
self
.
url
)[
0
])]
transcodes
=
self
.
transcodes
.
exclude
(
processing
=
True
).
filter
(
error_message__exact
=
''
)
sources
=
[]
for
transcode
in
transcodes
:
sources
.
append
(
"<source src='{0}' type='video/{1}' >"
.
format
(
transcode
.
url
,
transcode
.
media_format
.
name
))
mime
=
mimetypes
.
MimeTypes
()
sources
.
append
(
"<source src='{0}' type='{1}'>"
.
format
(
self
.
url
,
mime
.
guess_type
(
self
.
url
)[
0
]))
sources
.
append
(
"<p>Sorry, your browser doesn't support playback for this video</p>"
)
return
mark_safe
(
"<video {0}>
\n
{1}
\n
</video>"
.
format
(
flatatt
(
attrs
),
"
\n
"
.
join
(
sources
)))
...
...
wagtailvideos/templatetags/wagtailvideos_tags.py
View file @
16d57461
from
__future__
import
absolute_import
,
print_function
,
unicode_literals
import
mimetypes
from
django
import
template
from
django.forms.widgets
import
flatatt
from
django.utils.text
import
mark_safe
register
=
template
.
Library
()
# {% video self.intro_video extra_att extra_att %}
...
...
@@ -39,16 +35,4 @@ class VideoNode(template.Node):
if
not
video
:
raise
template
.
TemplateSyntaxError
(
"video tag requires a Video object as the first parameter"
)
if
video
.
thumbnail
:
self
.
attrs
[
'poster'
]
=
video
.
thumbnail
.
url
mime
=
mimetypes
.
MimeTypes
()
sources
=
[
"<source src='{0}' type='{1}'>"
.
format
(
video
.
url
,
mime
.
guess_type
(
video
.
url
)[
0
])]
transcodes
=
video
.
transcodes
.
exclude
(
processing
=
True
).
filter
(
error_message__exact
=
''
)
for
transcode
in
transcodes
:
sources
.
append
(
"<source src='{0}' type='video/{1}' >"
.
format
(
transcode
.
url
,
transcode
.
media_format
.
name
))
sources
.
append
(
"<p>Sorry, your browser doesn't support playback for this video</p>"
)
return
mark_safe
(
"<video {0}>{1}</video>"
.
format
(
flatatt
(
self
.
attrs
),
"
\n
"
.
join
(
sources
)))
return
video
.
video_tag
(
self
.
attrs
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment