function getQueryString(key) {
var search = window.location.search,
reg = new RegExp('[?&]' + key + '=([^&]+)', 'i'),
m = reg.exec(search);
return m && m.length > 1 ? m[1] : '';
}
// 强制隐藏控制栏
var hidedb = getQueryString('hidedb');
if(hidedb) {
var style1 = document.createElement('style');
style1.innerHTML = '.x-dashboard{display:none !important;}';
document.head.appendChild(style1);
}
(function() {
var vid = getQueryString('vid'),
bid = getQueryString('bid'),
site = getQueryString('site'),
autoplay = getQueryString('autoplay') == 'true' ? true : false,
cover = unescape(getQueryString('cover')),
showCount = getQueryString('showcount') == 'false' ? false : true,
api_key = getQueryString('api_key') || '',
variables = getQueryString('vars') || [],
dlBanner = getQueryString('dlBanner') == 'false' ? false : true,
hotVideo = getQueryString('hotVideo') == 'false' ? false : true,
infoPanel = getQueryString('infoPanel') == 'false' ? false : true,
disablePlaylist = getQueryString('disablePlaylist') == 'false' ? false : true,
mute = getQueryString('mute') == '1' ? 1 : 0,
resolution = getQueryString('resolution') == 'false' ? false : true,
isSohuZx = getQueryString('isSohuZx') == 'true' ? true : false;
if(variables) {
try{
variables = JSON.parse(decodeURIComponent(variables))
if(api_key && Object.prototype.toString.call(variables) == '[object Array]') {
variables.push(['api_key',api_key]);
}
} catch(e) {}
}
var eMap = ['data.ok', 'play', 'pause', 'ended'];
if (!vid && !bid && !lid) {
return;
}
var isloop = getQueryString('isloop');
if(isloop) {
variables.push(['onStop', 'window.swfGotoNewPage'])
window.swfGotoNewPage = function() {
if(window._player) {
window._player.replay();
} else {
// document.querySelector('embed').playVideo();
showPlayer({
el: '#sohuplayer',
vid: vid,
bid: bid,
autoplay: autoplay,
playercover: cover,
variables: variables,
disablePlaylist:disablePlaylist,
mute: mute
});
}
}
}
// 是搜狐资讯客户端
if(isSohuZx) {
// 强播放mp4资源
variables.push(['playMp4', true]);
// 播放结束展示封面
variables.push(['showEndPoster', true]);
// 是否展示错误信息面板
variables.push(['showErrorAppBtn', false]);
}
showPlayer({
el: '#sohuplayer',
vid: vid,
bid: bid,
site: site,
autoplay: autoplay,
playercover: cover,
variables: variables,
disablePlaylist:disablePlaylist,
mute: mute,
// m站播放器参数
showCount: showCount,
autoplay: autoplay,
dlBanner: dlBanner,
hotVideo: hotVideo,
infoPanel: infoPanel,
resolution: resolution
});
})();