just use video tag

This commit is contained in:
Sanj 2012-04-09 15:09:47 +05:30
parent 0529ac259b
commit f2915b63a3
2 changed files with 7 additions and 1 deletions

View File

@ -92,6 +92,10 @@ class PadmaClip(ItfModel):
object_id = models.PositiveIntegerField() object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id') content_object = generic.GenericForeignKey('content_type', 'object_id')
@property
def video_src(self, size=240):
return "http://%s/%s/%dp.webm" % (PANDORA_BASE, self.padmavideo.padma_id, size)
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
embed_code = self.embed_code embed_code = self.embed_code
regex = r'\<iframe width=\"([0-9]{1,3})\" height\=\"([0-9]{1,3})\" src\=\"http\:\/\/pad.ma\/([A-Z]{1,8})\/embed\?in\=([0-9\.].*?)\&out\=([0-9\.].*?)\&view\=video\" frameborder\=\"0\" allowfullscreen></iframe>' regex = r'\<iframe width=\"([0-9]{1,3})\" height\=\"([0-9]{1,3})\" src\=\"http\:\/\/pad.ma\/([A-Z]{1,8})\/embed\?in\=([0-9\.].*?)\&out\=([0-9\.].*?)\&view\=video\" frameborder\=\"0\" allowfullscreen></iframe>'

View File

@ -103,7 +103,9 @@
{% ifnotequal talk.videos.all|length 0 %} {% ifnotequal talk.videos.all|length 0 %}
<div class="padmaVideos"> <div class="padmaVideos">
{% for v in talk.videos.all %} {% for v in talk.videos.all %}
{{ v.embed_code|safe }} <video src="{{ v.video_src }}" width="480"></video><br />
{% endfor %} {% endfor %}
</div> </div>
{% endifnotequal %} {% endifnotequal %}