Skip to content

Commit

Permalink
fix default player size (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Yunenko committed Apr 11, 2020
1 parent 8123e8d commit 456c05f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 19 deletions.
15 changes: 15 additions & 0 deletions djangocms_video/static/djangocms_video/video_player.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.djangocms-video-plugin {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
}

.djangocms-video-plugin iframe, object, embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
42 changes: 23 additions & 19 deletions djangocms_video/templates/djangocms_video/default/video_player.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
{% load i18n cms_tags %}
{% load i18n cms_tags static %}

{% if instance.embed_link %}
{# show iframe if embed_link is provided #}
<iframe src="{{ instance.embed_link_with_parameters }}" {{ instance.attributes_str }} frameborder="0" allowfullscreen="true"></iframe>
{% with disabled=instance.embed_link %}
{% for plugin in instance.child_plugin_instances %}
{% render_plugin plugin %}
{% endfor %}
{% endwith %}
{% else %}
{# render <source> or <track> plugins #}
<video controls {{ instance.attributes_str }}
{% if instance.poster %} poster="{{ instance.poster.url }}"{% endif %}>
{% for plugin in instance.child_plugin_instances %}
{% render_plugin plugin %}
{% endfor %}
{% trans "Your browser doesn't support this video format." %}
</video>
{% endif %}
<link rel="stylesheet" type="text/css" href="{% static 'djangocms_video/video_player.css' %}"/>

<div class="djangocms-video-plugin">
{% if instance.embed_link %}
{# show iframe if embed_link is provided #}
<iframe src="{{ instance.embed_link_with_parameters }}" {{ instance.attributes_str }} frameborder="0" allowfullscreen="true"></iframe>
{% with disabled=instance.embed_link %}
{% for plugin in instance.child_plugin_instances %}
{% render_plugin plugin %}
{% endfor %}
{% endwith %}
{% else %}
{# render <source> or <track> plugins #}
<video controls {{ instance.attributes_str }}
{% if instance.poster %} poster="{{ instance.poster.url }}"{% endif %}>
{% for plugin in instance.child_plugin_instances %}
{% render_plugin plugin %}
{% endfor %}
{% trans "Your browser doesn't support this video format." %}
</video>
{% endif %}
</div>

{% comment %}
# Available variables:
Expand Down

0 comments on commit 456c05f

Please sign in to comment.