Fix video-js resize

This commit is contained in:
Romain Neutron
2012-07-16 17:29:54 +02:00
parent 8c51c16bb2
commit a911e0745a
2 changed files with 12 additions and 3 deletions

View File

@@ -6,12 +6,16 @@
{% if wrap %} {% if wrap %}
<div style="width:{{ displayWidth | round }}px;height:{{ displayHeight | round }}px;" class="thumb_wrapper {{ extraclass | default('') }}"> <div style="width:{{ displayWidth | round }}px;height:{{ displayHeight | round }}px;" class="thumb_wrapper {{ extraclass | default('') }}">
{% endif %} {% endif %}
<div class="record record_video imgTips" style="position:relative;width:{{ displayWidth | round }}px;height:{{ displayHeight | round }}px;"> <div class="record record_video imgTips" style="position:relative;width:{{ displayWidth | round }}px;height:{{ displayHeight | round }}px;">
<video id="video_preview_tooltip" class="videoTips video-js vjs-default-skin" controls autoplay <video id="video_preview_tooltip" class="videoTips video-js vjs-default-skin" controls autoplay
preload="auto" xposter="my_video_poster.png" width="{{ displayWidth|round }}" height="{{ displayHeight | round }}" preload="auto" xposter="my_video_poster.png" width="{{ displayWidth|round }}" height="{{ displayHeight | round }}"
data-setup="{}"> data-setup="{}">
{% for name, subdef in arraySubdefs %} {% for name, subdef in arraySubdefs %}
{% if loop.first %}
<input type="hidden" name="width" value="{{subdef.get_width()}}"/>
<input type="hidden" name="height" value="{{subdef.get_height()}}"/>
{% endif %}
{% if session.is_authenticated() == true %} {% if session.is_authenticated() == true %}
{% set url = subdef.get_url() %} {% set url = subdef.get_url() %}
{% else %} {% else %}
@@ -26,7 +30,11 @@
$(document).ready(function(){ $(document).ready(function(){
try { try {
_V_("video_preview_tooltip", {}, function(){ _V_("video_preview_tooltip", {}, function(){
var player = this;
$('#video_preview_tooltip').parent().bind('resize-video-js', function(){
player.width($(this).width());
player.height($(this).height());
});
}); });
} catch(err) { } catch(err) {
console.error('An error has been catched during the execution of VideoJS', err); console.error('An error has been catched during the execution of VideoJS', err);

View File

@@ -498,6 +498,7 @@ function setPreview(){
top: t, top: t,
left: l left: l
}).attr('width',w).attr('height',h); }).attr('width',w).attr('height',h);
$('#PREVIEWIMGCONT .record').trigger('resize-video-js');
} }
function classicMode(){ function classicMode(){
@@ -527,7 +528,7 @@ function closePreview(){
cancelPreview(); cancelPreview();
$(this).dequeue(); $(this).dequeue();
}); });
$.each($('#PREVIEWBOX video'), function(i,el){ $.each($('#PREVIEWBOX video'), function(i,el){
_V_($(el).attr('id')).destroy(); _V_($(el).attr('id')).destroy();
}); });