jazzband / django-embed-video

Django app for easy embedding YouTube and Vimeo videos and music from SoundCloud.
http://django-embed-video.rtfd.org
MIT License
383 stars 135 forks source link

Get type of video #5

Closed tomtichy closed 11 years ago

tomtichy commented 11 years ago

Hi, I think it would be useful to provide something like my_video.type in template tag. It would containt youtube, vimeo etc. Because I need to do something like this:

{% video item.video as my_video %}
  <iframe width="500" height="281" 
      frameborder="0" allowfullscreen
      webkitAllowFullScreen mozallowfullscreen allowFullScreen

      {% if my_video.type == "youtube" %}
        src="{{ my_video.url }}?rel=0" 
      {% elif my_video.type == "vimeo" %}
        src="{{ my_video.url }}?byline=0&amp;portrait=0&amp;color=ff0179&amp;autoplay=1" 
      {% endif %}
    ></iframe>
{% endvideo %}