Template tags

You have to load template tag library first.

{% load embed_video_tags %}
class embed_video.templatetags.embed_video_tags.VideoNode(parser, token)[source]

Template tag video. It gives access to all VideoBackend variables.

Usage (shortcut):

{% video URL [SIZE] [key1=value1, key2=value2...] %}

Or as a block:

{% video URL [SIZE] [key1=value1, key2=value2...] as VAR %}
    ...
{% endvideo %}

Examples:

{% video item.video %}
{% video item.video "large" %}
{% video item.video "340x200" %}
{% video item.video "100% x 300" query="rel=0&wmode=opaque" %}

{% video item.video is_secure=True as my_video %}
    URL: {{ my_video.url }}
    Thumbnail: {{ my_video.thumbnail }}
    Backend: {{ my_video.backend }}
{% endvideo %}
classmethod embed(url, size, context=None, **options)[source]

Direct render of embed video.

Parameters:
  • url (str) – URL to embed video
  • size (str) – Size of rendered block
  • context (django.template.RequestContext | None) – Django template RequestContext
static get_backend(backend_or_url, context=None, **options)[source]

Returns instance of VideoBackend. If context is passed to the method and request is secure, than the is_secure mark is set to backend.

A string or VideoBackend instance can be passed to the method.

Parameters:
  • backend – Given instance inherited from VideoBackend or url
  • context (django.template.RequestContext | None) – Django template RequestContext
Return type:

VideoBackend

classmethod get_size(value)[source]

Predefined sizes:

size width height
tiny 420 315
small 480 360
medium 640 480
large 960 720
huge 1280 960

You can also use custom size - in format WIDTHxHEIGHT (eg. 500x400).

Returns:Returns tuple with (width, height) values.
Return type:tuple[int, int]
render(context)[source]

Returns generated HTML.

Parameters:context (django.template.RequestContext) – Django template RequestContext
Returns:Rendered HTML with embed video.
Return type:django.utils.safestring.SafeText | str
render_block(context, backend)[source]
Parameters:
  • context (django.template.RequestContext) – Django template RequestContext
  • backend (VideoBackend) – Given instance inherited from VideoBackend
Return type:

django.utils.safestring.SafeText

resolve_options(context)[source]
Parameters:context (django.template.RequestContext) – Django template RequestContext