2012-03-08 63 views
0

我在宽度和高度标记中使用100%,无论浏览器在第一次打开时的大小,播放器都能正常工作,但只要我调整浏览器大小的控件可以继续工作,并且视频正在播放视频退出播放,并且屏幕变黑。我必须添加一些东西吗?或者这只是一个错误?哦,是的,这发生在Firefox 10.0.2。流动播放器在浏览器重新调整大小后不起作用

这里是我的代码:

<video width="100%" height="100%" id="player2" poster="media/Memphis-Beat_Ring-of-Fire.jpg" controls="controls" preload="none"> 
        <source type="video/mp4" src="media/Memphis-Beat_Ring-of-Fire.mp4" /> 
       </video> 
       <script> 
        $('audio,video').mediaelementplayer({ 
         success: function(player, node) { 
          //$('#' + node.id + '-mode').html('mode: ' + player.pluginType); 
         } 
        }); 
       </script> 

回答

1

这确实让我生气了。我通过创建一个调整播放器大小的函数来解决它...

// For adjusting the player size on the fly 
      var adjustVideoSize = function(me, el) { 
       var width = $('.a_wrapper_that_is_fluid_width').width(); 
       var height = $('.a_wrapper_that_is_fluid_width').height(); 
       // min dimensions for the player 
       if (width < 256) width = 256; 
       if (height < 110) height = 110; 
       // MediaElement methods for resizing 
       me.setVideoSize(width, height); 
       var player = me.player || el.player; 
       player.setPlayerSize(width, height); 
       player.setControlsSize(); 
      }; 

并在每次调整窗口大小时调用它。

相关问题