使用Jscript在Jw Player中呈现高清视频文件

时间:2011-04-04 11:47:39

标签: javascript video-streaming jwplayer

如何在此代码中添加高清视频文件?高清插件已启用。我经历了documentations。但是没有得到我在这段代码中如何实现它。

<script type='text/javascript' src='swfobject.js'></script>

<div id='mediaspace'>This text will be replaced</div>

<script type='text/javascript'>
  var so = new SWFObject('player.swf','mpl','470','320','9');
  so.addParam('allowfullscreen','true');
  so.addParam('allowscriptaccess','always');
  so.addParam('wmode','opaque');
  so.addVariable('file','sample.mp4');
  so.addVariable('plugins','hd-1');
  so.write('mediaspace');
</script>

1 个答案:

答案 0 :(得分:0)

好吧,我发现了。

<script type="text/javascript">
        var flashvars = {
                'file':                 'sd-video.mp4',

                'hd.file':              'hd-video.mp4',
                'hd.state':             'true'
        };
        var params = {

                'allowfullscreen':      'true',
                'allowscriptaccess':    'always',
                'bgcolor':              '#ffffff'

        };
        var attributes = {
                'id':                   'player1',

                'name':                 'player1'
        };
        SWFObject.embedSWF('player.swf', 'flashContent', '300', '250', '9', 'false', flashvars, params, attributes);

</script>

就我而言,我可以像这样引用高清视频:

<script type='text/javascript' src='swfobject.js'></script>

<div id='mediaspace'>This text will be replaced</div>

<script type='text/javascript'>
  var so = new SWFObject('player.swf','mpl','470','320','9');
  so.addParam('allowfullscreen','true');
  so.addParam('allowscriptaccess','always');
  so.addParam('wmode','opaque');
  so.addVariable('file','sample.mp4');//reference to sd video.
  so.addVariable('hd.file','hd_sample.mp4');//reference to the hd version of video.
  so.addVariable('hd.state','true'); //too choose hd as default.
  so.addVariable('plugins','hd-1');
  so.write('mediaspace');
</script>