return oembed iframe in aspect ratio of video and use new embed url
This commit is contained in:
parent
889754273a
commit
0a07097f22
1 changed files with 9 additions and 8 deletions
|
@ -1064,8 +1064,8 @@ def atom_xml(request):
|
||||||
|
|
||||||
def oembed(request):
|
def oembed(request):
|
||||||
format = request.GET.get('format', 'json')
|
format = request.GET.get('format', 'json')
|
||||||
maxwidth = request.GET.get('maxwidth', 640)
|
maxwidth = int(request.GET.get('maxwidth', 640))
|
||||||
maxheight = request.GET.get('maxheight', 480)
|
maxheight = int(request.GET.get('maxheight', 480))
|
||||||
|
|
||||||
url = request.GET['url']
|
url = request.GET['url']
|
||||||
parts = urlparse(url).path.split('/')
|
parts = urlparse(url).path.split('/')
|
||||||
|
@ -1073,6 +1073,7 @@ def oembed(request):
|
||||||
#fixme: embed should reflect actuall url
|
#fixme: embed should reflect actuall url
|
||||||
item = get_object_or_404_json(models.Item, itemId=itemId)
|
item = get_object_or_404_json(models.Item, itemId=itemId)
|
||||||
embed_url = request.build_absolute_uri('/%s/embed' % item.itemId)
|
embed_url = request.build_absolute_uri('/%s/embed' % item.itemId)
|
||||||
|
embed_url = '%s#?embed=true' % url
|
||||||
oembed = {}
|
oembed = {}
|
||||||
oembed['version'] = '1.0'
|
oembed['version'] = '1.0'
|
||||||
oembed['type'] = 'video'
|
oembed['type'] = 'video'
|
||||||
|
@ -1081,13 +1082,13 @@ def oembed(request):
|
||||||
oembed['title'] = item.get('title')
|
oembed['title'] = item.get('title')
|
||||||
#oembed['author_name'] = item.get('director')
|
#oembed['author_name'] = item.get('director')
|
||||||
#oembed['author_url'] = ??
|
#oembed['author_url'] = ??
|
||||||
height = 96
|
height = max(settings.CONFIG['video']['resolutions'])
|
||||||
width = 128
|
height = min(height, maxheight)
|
||||||
if maxheight > height or height > maxheight:
|
width = int(round(height * item.stream_aspect))
|
||||||
height = maxheight
|
if width > maxwidth:
|
||||||
if maxwidth > width or width > maxwidth:
|
|
||||||
width = maxwidth
|
width = maxwidth
|
||||||
oembed['html'] = '<iframe width="%s" height="%s" src="%s" frameborder="0" allowfullscreen></iframe>' % (width, height, embed_url)
|
height = min(maxheight, int(width / item.stream_aspect))
|
||||||
|
oembed['html'] = '<iframe width="%s" height="%s" src="%s" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>' % (width, height, embed_url)
|
||||||
oembed['width'] = width
|
oembed['width'] = width
|
||||||
oembed['height'] = height
|
oembed['height'] = height
|
||||||
thumbheight = 96
|
thumbheight = 96
|
||||||
|
|
Loading…
Reference in a new issue