mirror of
https://github.com/Hopiu/django-embed-video.git
synced 2026-03-16 21:30:23 +00:00
Usage
This commit is contained in:
parent
4c5d212690
commit
d05d608599
1 changed files with 58 additions and 0 deletions
58
README
58
README
|
|
@ -3,3 +3,61 @@ django-embed-video
|
|||
|
||||
Django app for easy embeding YouTube and Vimeo videos.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
pip install django-embed-video
|
||||
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
Template examples
|
||||
*****************
|
||||
|
||||
First you have to load the `embed_video_tags` template tags in your template:
|
||||
|
||||
{% load embed_video_tags %}
|
||||
|
||||
Simple embeding of video:
|
||||
|
||||
{% video item.video as video %}
|
||||
{{ video|embed:'small' }}
|
||||
{% endvideo %}
|
||||
|
||||
Default sizes are `tiny` (420x315), `small` (480x360), `medium` (640x480),
|
||||
`large` (960x720) and `huge` (1280x960). You can set your own size:
|
||||
|
||||
{{ video|embed:'800x600' }}
|
||||
|
||||
Usage of variables:
|
||||
|
||||
{% video item.video as video %}
|
||||
URL: {{ video.url }}
|
||||
Thumbnail: {{ video.thumbnail }}
|
||||
{% endvideo %}
|
||||
|
||||
|
||||
Model examples
|
||||
***************
|
||||
|
||||
Using the EmbedVideoField you provide validation of correct URL.
|
||||
|
||||
from django.db import models
|
||||
from embed_video.fields import EmbedVideoField
|
||||
|
||||
class Item(models.Model):
|
||||
video = EmbedVideoField() # same like models.URLField()
|
||||
|
||||
|
||||
TODO
|
||||
-----
|
||||
|
||||
- provide AdminEmbedVideoMixin
|
||||
- Vimeo thumbnail
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue