我在我的网站上使用JWPlayer8。有没有一种方法可以自动调整MP4文件的质量?我想用一个视频文件自动设置质量。我通过player.tpl文件执行与视频播放器有关的所有操作。如果您能提供帮助,我将不胜感激。谢谢。播放器的代码段如下;
{elseif $video_data.video_player == "jwplayer8"}
<div id="Playerholder">
<noscript>
{$lang.enable_javascript}
</noscript>
<em>{$lang.please_wait}</em>
</div>
{literal}
<script type="text/javascript" src="{/literal}{$smarty.const._URL2}{literal}/players/jwplayer8/jwplayer.js"></script>
<script type="text/javascript">jwplayer.key="{/literal}{$jwplayerkey}{literal}";</script>
<script type="text/javascript">
var flashvars = {
{/literal}
{if $video_data.source_id == 0}
file: '{$video_data.jw_flashvars.file}',
streamer: '{$video_data.jw_flashvars.streamer}',
{literal}rtmp: {{/literal}
{if $video_data.jw_flashvars.provider != ''} provider: '{$video_data.jw_flashvars.provider}',{/if}
{if $video_data.jw_flashvars.startparam != ''} startparam: '{$video_data.jw_flashvars.startparam}',{/if}
{if $video_data.jw_flashvars.loadbalance != ''} loadbalance: {$video_data.jw_flashvars.loadbalance},{/if}
{if $video_data.jw_flashvars.subscribe != ''} subscribe: {$video_data.jw_flashvars.subscribe},{/if}
{if $video_data.jw_flashvars.securetoken != ''} securetoken: "{$video_data.jw_flashvars.securetoken}",{/if}
},
{elseif $video_data.source_id == $_sources.localhost.source_id}
{literal}
file: '{/literal}{$video_data.url_flv}{literal}',
//image: '{/literal}{$video_data.preview_image}{literal}',
{/literal}
{elseif $video_data.source_id == $_sources.youtube.source_id}
{literal}
file: '{/literal}{$video_data.direct}{literal}',
//image: '//img.youtube.com/vi/{/literal}{$video_data.yt_id}{literal}/hqdefault.jpg',
{/literal}
{elseif $video_data.source_id == $_sources.mp3.source_id}
{literal}
file: '{/literal}{$video_data.url_flv}{literal}',
type: 'mp3',
//image: '{/literal}{$video_data.preview_image}',
{else}
{literal}
file: '{/literal}{$video_data.url_flv}{literal}',
//image: '{/literal}{$video_data.preview_image}',
{/if}
{literal}
flashplayer: "{/literal}{$smarty.const._URL2}{literal}/players/jwplayer8/jwplayer.flash.swf",
primary: "html5",
width: "100%",
{/literal}{if $playlist}{literal}
height: "401",
autostart: true,
{/literal}{else}{literal}
height: "{/literal}{$smarty.const._PLAYER_H}{literal}",
autostart: "{/literal}{$video_data.video_player_autoplay}{literal}",
{/literal}{/if}{literal}
image: '{/literal}{$video_data.preview_image}{literal}',
stretching: "uniform",
"preload": "metadata",
"aspectratio": "16:9",
events: {
onComplete: function() {
{/literal}{if $playlist}{literal}
window.location = "{/literal}{$playlist_next_url}{literal}";
{/literal}{else}{literal}
if (pm_video_data.autoplay_next && pm_video_data.autoplay_next_url != "") {
window.location = pm_video_data.autoplay_next_url;
}
{/literal}{/if}{literal}
},
onError: function(object) {
ajax_request("video", "do=report&vid={/literal}{$video_data.uniq_id}{literal}&error-message="+ object.message, "", "", false);
{/literal}{if $playlist}{literal}
window.location = "{/literal}{$playlist_next_url}{literal}";
{/literal}{/if}{literal}
}
},
logo: {
file: '{/literal}{$smarty.const._WATERMARKURL}{literal}',
link: '{/literal}{$smarty.const._WATERMARKLINK}{literal}',
},
"playbackRateControls": true,
"airplay":true,
"sharing": {
"sites": [
"facebook",
"twitter",
"email"
]
},
"tracks": [
{/literal}{foreach from=$video_subtitles key=k item=video_subtitles}{literal}
{ file: "{/literal}{$video_subtitles.filename}{literal}", label: "{/literal}{$video_subtitles.language}{literal}", kind: "subtitles" },
{/literal}{/foreach}{literal}
]
};
{/literal}{$jw_flashvars_override}{literal}
jwplayer("Playerholder").setup(flashvars);
</script>
{/literal}